Poor Jenkins&Git integration...When I was trying to setup some git jobs in Jenkins today, it turned out to be more tricky than I initially expected.
Upgrading to latest Jenkins 1.506 and Git Plugin 1.3.0, we were off to a bad start:
Command "/usr/bin/git clone --progress -o origin ssh://gitserver.company.com:22/project/one /path/to/jenkins/jobs/test/workspace" returned status code 128: Cloning into an existing directory is not allowed.
After quite a lot of digging, I finally found the root-cause, solution and a work-around...
SolutionUpgrade Git to at least version 18.104.22.168.
Work-aroundDowngrade Jenkin's "Git client Plugin" to version 1.0.2 (Download from here: https://updates.jenkins-ci.org/download/plugins/git-client/1.0.2/git-client.hpi)
Root-cause"Cloning into an existing directory is only allowed if the directory is empty." only became reality in later versions of Git.
While Jenkin's "Git client Plugin" made a change (JENKINS-16873) in version 1.0.3 which relies on this feature, any installation with an older Git will fail to work.