Reputation: 20080
I am using Jenkins 1.484 under Windows 7 and I have troubles with cloning a git repository.
I have configured Git correctly, but when I try to clone a repository, this takes forever and never succeed. It gets halted just after:
git --version git version 1.7.9.msysgit.0
If after ten minutes I do halt the build, that's what I see:
ERROR: Error cloning remote repo 'origin' : Could not clone [email protected]:GBSA/Gottware-server.git
hudson.plugins.git.GitException: Could not clone [email protected]:GBSA/Gottware-server.git
at hudson.plugins.git.GitAPI.clone(GitAPI.java:271)
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1040)
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:982)
at hudson.FilePath.act(FilePath.java:851)
at hudson.FilePath.act(FilePath.java:824)
at hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:982)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1138)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1256)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:589)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:494)
at hudson.model.Run.execute(Run.java:1502)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:236)
Caused by: hudson.plugins.git.GitException: Error performing command: C:\Program Files (x86)\Git\bin\git.exe clone --progress -o origin [email protected]:GBSA/Gottware-server.git G:\jenkins\workspaces\gottwareproductiontests
at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:870)
at hudson.plugins.git.GitAPI.access$000(GitAPI.java:40)
at hudson.plugins.git.GitAPI$1.invoke(GitAPI.java:267)
at hudson.plugins.git.GitAPI$1.invoke(GitAPI.java:246)
at hudson.FilePath.act(FilePath.java:851)
at hudson.FilePath.act(FilePath.java:824)
at hudson.plugins.git.GitAPI.clone(GitAPI.java:246)
... 14 more
Caused by: java.lang.InterruptedException
at java.lang.ProcessImpl.waitFor(Native Method)
at hudson.Proc$LocalProc.join(Proc.java:319)
at hudson.Launcher$ProcStarter.join(Launcher.java:352)
at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:851)
... 20 more
Trying next repository
ERROR: Could not clone repository
FATAL: Could not clone
hudson.plugins.git.GitException: Could not clone
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1052)
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:982)
at hudson.FilePath.act(FilePath.java:851)
If on the contrary I try to execute the same GIT I have configured from the command line, the clone succeed
C:\Program Files (x86)\Git\bin>"C:\Program Files (x86)\Git\bin\git.exe" clone --progress -o origin [email protected]:GBSA/Gottware-server.git G:\jenkins\
workspaces\gottwareproductiontests
Cloning into 'G:\jenkins\workspaces\gottwareproductiontests'...
remote: Counting objects: 38007, done.
remote: Compressing objects: 100% (16268/16268), done.
What is going wrong?
Upvotes: 1
Views: 3030
Reputation: 33193
On Windows, the Jenkins process is run as a system service so it is running as the SYSTEM user and not using your account. You are using a [email protected] type URL so that is trying to use SSH which will require a ssh key to be found either from an ssh agent like pageant or from ~/.ssh/identity when run as the SYSTEM user.
The simplest solution will be to use a http or https transport instead. As you are pulling and not pushing when you perform builds, you don't need to configure a username or password for these protocols. You could possibly use the git protocol (git://github.com/...) if you local network configuration will permit that.
Alternatively, you can use psexec from sysinternals to get a command prompt as the system user and fix up the local environment so that ssh will work. psexec -i -s cmd.exe
will yield a SYSTEM command prompt and you can then run the msysGit bash shell and set up a suitable ssh key to register with the remote system. I've been using this on XP - so its possible it is no longer applicable on Win7. You can also configure Jenkins to run as another user account but I've not used that method locally.
Upvotes: 4