I\'m trying to set up Jenkins on a Windows Server 2012 machine, and I\'m having a lot of difficulty.
Things I\'ve done:
i
Here's how I fixed a similar issue:
Msysgit installs two git.exe
. One under C:\Program Files (x86)\Git\bin
and a second one under C:\Program Files (x86)\Git\cmd
. The first one cannot be used with Jenkins. It will hang after completing it's job. The second one works perfectly.
Update your Jenkins Git settings to point to the correct cmd\git.exe
and enjoy!
Another link that I found very helpful when configuring jenkins on windows, especially when using the MSI installer is this: http://opensourcetester.co.uk/2013/06/28/jenkins-windows-ssh/
And one more thing that I didn't find obvious was: you have to use SSH url when connecting to Github instead of default https one. Hopefully that will save time to someone.
Version 2.6.1 of the Git client for Windows fixes this problem in Jenkins. Now “Fetching upstream changes from origin” has no delay.
I am using the git cmd in Jenkins from:
C:\Program Files\Git\cmd\git.exe
For me it was the permissions on the $HOME/.ssh folder and its content. After setting it visible for the specific user group, Jenkins was able to fetch the changes after a restart.
This is how I solved it:
I ran the sysinternals tool psexec to spawn a CMD which is running under the LocalSystem account (same account like jenkins service is running)
PSEXEC -i -s -d CMD
In this cmd prompt I executed the same git command from the workspace directory as the hanging GIT.exe processes do. E.g.
d:\Programs\Jenkins\jobs\jobname\workspace>D:\Programs\Git\bin\git.exe fetch -t ssh+git://gitpub@my.server.com:9360/data/gitpub/myRepository.git +refs/heads/:refs/remotes/origin/
Et voila: I was prompted to enter "yes" to add the SSH key to the known list of known hosts.
I spent few hours trying to figure this out and I found out that adding the password to the repo URL fixed the issue:
https://USERNAME:PASSWORD@bitbucket.org/REPO.git
Please note the : between username and password