Reputation: 317
Hi I have jenkins set up with three unix machines slaves binding with ssh keys and able to do git clone successfully..
Now I want to add windows machine for the same master with ssh concept. I have copied one of the above slave machine ssh keys and did manual git clone command works fine.
Similary I tried to clone git in jenkins. Below are two observations.
Updated "git installation" path in "“Manage Jenkins” –> “Configure System ” to "\C:\Program Files (x86)\Git\cmd\git.com" from "git" as per http://computercamp-cdwilson-us.tumblr.com/post/48589650930/jenkins-git-clone-via-ssh-on-windows-7-x64. In this case git clone successful for windows machine job, but other unix machine jobs were failed clone with an error..hudson.plugins.git.GitException: Error performing command: C:\Program Files (x86)\Git\cmd\git.cmd rev-parse --is-inside-work-tree
Updated "git installation" path in "“Manage Jenkins” –> “Configure System ” to "git". In this case unix machine jobs were successfully cloned, but windows machine job was failed to clone with an error...ERROR: Error cloning remote repo 'origin' : Could not clone ssh://git@........
So we need two different path for unix and windows jobs or update one common path in which both the jobs (unix and window) runs successfully.
Any help on this issue highly appreciated..Thanks.
Upvotes: 0
Views: 10039
Reputation: 1248
Update your system environment variables with your Git\bin path.
Then update your Jenkins Slave's node properties with Tool Location.
List of tool locations
Name Git(Default)
Home your git.exe directory path (Git\bin\git.exe)
Upvotes: 1
Reputation: 41
Please use C:\Program Files\git\Cmd\git.exe as the git environment variable for the windows slave configuration in Jenkins.
1) Manage Jenkins 2) Manage Nodes 3) Select Windows slave -> go to configuration 4) Add Environment variables for GIT as above complete path.
Also, go to global security settings -> Enable Slave -> Master.
This should work.
Cheers, Ashoka.
Upvotes: 2
Reputation: 11075
Each Jenkins slave configuration can have git tool config which overrides the global config.
Click "Manage Jenkins" -> "Manage nodes" -> click one of the slaves -> click "Configure" on the left -> Check the box named "Tool locations". Click "Add". From the pop-up menu choose "Git". Enter path to the git executable on that slave.
Upvotes: 3