Monday, August 22, 2011

Jenkins and Git

I've been setting up Jenkins for a client. While setting up a project, I ran into a very strange problem in which Jenkins (or more precisely, the git plugin) couldn't find git.

Here's what I did:
1. install Jenkins
2. create a project (call it "Foo")
3. say, "whoops. forgot the Git plugin"
4. install the Git plugin through Jenkins
5. restart Jenkins
6. configure the repo in Foo
7. build

I kept getting the error:
Error trying to determine the git version: --version
Assume 1.6

It couldn't see the git binary. I set the git binary in the main Jenkins config to "git" and to "/usr/bin/git", with no change. I also confirmed that the jenkins user could run the git binary, which it could.

The Fix:
To fix it, I deleted the project and created a new one. After all that, apparently you have to install the Git plugin before you create the project.

Lesson learned.


  1. Also, if you're hosting Jenkins on Windows, the Windows version of Git when installed puts the path to the Git batch command on the Path environment variable as opposed to the git.exe binary. Jenkins doesn't like this.

  2. Thanks you so much dude, I have lost a scary amount of time in code, docs, blogs and bug reports before I found this.. so simple.. sigh..