Recently I set up a new instance of Jenkins (formerly Hudson) running on my Windows 7 desktop computer. I tried to set up a job that would pull from a GitHub repository and do a build but (like every other time I've tried this) was foiled by the job simply hanging at the step where it tries to clone or fetch from GitHub. Cancelling the job leads to the following errors in the console output:
First, I tried the usual suspects:
Ensuring that Jenkins was running as the correct user.
Ensuring that the user's .ssh directory and keys were in place and checked out.
Trying the full path to git.exe in Git's bin directory rather than just using git as the path.
I did a search for the error, but as in the past it turned up no solutions that actually fixed the problem for me. I then tried running a job that just executed a Windows batch command to run git clone on the same repository... which worked fine!
The solution
Double-checking things, I noticed that my PATH contained two directories for my Git installation (msysgit): one for Git/bin and another for Git/cmd, which I hadn't been aware of before. Looking in Git/cmd, I noticed that it contained a file git.cmd which appeared to be some kind of script wrapping git.exe. So, I went into the Jenkins configuration and changed the path to the git executable to git.cmd. And that fixed everything!
Based on what I've seen when searching for this error, it seems like there are quite a few potential causes for it. But this is what worked for me in my situation and I haven't seen this solution elsewhere, so I thought I'd write it down... if nothing else to help me remember if it happens again.
Hey, thanks for the post! Sadly, I'm still having the same problem. Can I ask you a question: what do you mean by "Ensuring that Jenkins was running as the correct user."? I have pageant running as a collaborator on a project, and I can clone using GIT GUI, but Jenkins fails. Do I somehow have to run the Jenkins service as a different user tied to the SSH collaborator key? Any help you could provide would be most appreciated. Thanks, Landon [email protected]
@RambleCampbell: I just mean ensuring that Jenkins is running as the user you expect it to be running as and that that user has a .ssh directory in place that works for talking to github. Unfortunately, I probably can't help you more than that. I've fought with this issue a couple times and I think there are various things that can cause it, most of which I don't know how to fix off the top of my head. Good luck!
Hi, I am new to Jenkins and trying out some example from a tutorial, My build stuck after this "Cloning the remote Git repository Cloning repository origin" And i don't know where i have made mistake, but, i could successfully clone the code from command prompt
Thanks very much for the post! In more recent versions of Git, it appears that the Git/cmd directory contains another git.exe and not a git.cmd script. Regardless, changing the Jenkins configuration to point to Git/cmd/git.exe fixed the problem for me.
8 comments:
Hey, thanks for the post! Sadly, I'm still having the same problem. Can I ask you a question: what do you mean by "Ensuring that Jenkins was running as the correct user."? I have pageant running as a collaborator on a project, and I can clone using GIT GUI, but Jenkins fails. Do I somehow have to run the Jenkins service as a different user tied to the SSH collaborator key? Any help you could provide would be most appreciated. Thanks, Landon [email protected]
@RambleCampbell: I just mean ensuring that Jenkins is running as the user you expect it to be running as and that that user has a .ssh directory in place that works for talking to github. Unfortunately, I probably can't help you more than that. I've fought with this issue a couple times and I think there are various things that can cause it, most of which I don't know how to fix off the top of my head. Good luck!
I saw this too after getting just a config.xml in an email! It was easy enough to spot ...
<project>
:
<scm class="hudson.plugins.git.GitSCM">
:
<gitTool>Git for GitHub</gitTool>
:
</scm>
:
:
</project>
... versus ...
<project>
:
<scm class="hudson.plugins.git.GitSCM">
:
<gitTool>Default</gitTool>
:
</scm>
:
:
</project>
thnx.. I changed the user and it works fine
Hi, I am new to Jenkins and trying out some example from a tutorial,
My build stuck after this
"Cloning the remote Git repository
Cloning repository origin"
And i don't know where i have made mistake, but, i could successfully clone the code from command prompt
Can you please help me with some pointers?
Going into Jenkins config and pointing git to git.cmd worked for me too!
Thanks
Thanks very much for the post! In more recent versions of Git, it appears that the Git/cmd directory contains another git.exe and not a git.cmd script. Regardless, changing the Jenkins configuration to point to Git/cmd/git.exe fixed the problem for me.
Post a Comment