Saturday, 23 March 2013

Git clone not working in Jenkins

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://
 /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...


Upgrade Git to at least version


Downgrade Jenkin's "Git client Plugin" to version 1.0.2 (Download from here:


"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.