Git commands succeed within a build step but fail when the plugin executes them.

94 views
Skip to first unread message

Steve K

unread,
Sep 20, 2016, 1:03:58 PM9/20/16
to Jenkins Users
Hello,

I'm running Jenkins 2.7.3 from a CentOS master invoking Git commands on a Windows 8.1 machine.

git commands, such as the following, succeed when run within a "Windows batch command" step.
git clone --verbose --recursive --branch fs02 ssh://scmb...@rocgit01.corp.mycompany.com:29418/Crown.git


But, when the plugin tried to execute the command, I got:
Cloning the remote Git repository
Cloning repository ssh://scmb...@rocgit01.corp.mycompany.com:29418/Crown.git
 > git init C:\home\Evo # timeout=10
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Could not init C:\home\Evo
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:663)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:464)
	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:152)
	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:145)
	at hudson.remoting.UserRequest.perform(UserRequest.java:153)
	at hudson.remoting.UserRequest.perform(UserRequest.java:50)
	at hudson.remoting.Request$2.run(Request.java:332)
	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at hudson.remoting.Engine$1$1.run(Engine.java:85)
	at java.lang.Thread.run(Unknown Source)
	at ......remote call to nextgencibuild(Native Method)
	at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1416)
	at hudson.remoting.UserResponse.retrieve(UserRequest.java:253)
	at hudson.remoting.Channel.call(Channel.java:781)
	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:145)
	at sun.reflect.GeneratedMethodAccessor267.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:131)
	at com.sun.proxy.$Proxy53.execute(Unknown Source)
	at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1042)
	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1082)
	at hudson.scm.SCM.checkout(SCM.java:495)
	at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
	at hudson.model.Run.execute(Run.java:1741)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:98)
	at hudson.model.Executor.run(Executor.java:410)
Caused by: hudson.plugins.git.GitException: Error performing command: git init C:\home\Evo
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1759)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1725)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1721)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1391)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$5.execute(CliGitAPIImpl.java:661)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:464)
	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:152)
	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:145)
	at hudson.remoting.UserRequest.perform(UserRequest.java:153)
	at hudson.remoting.UserRequest.perform(UserRequest.java:50)
	at hudson.remoting.Request$2.run(Request.java:332)
	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at hudson.remoting.Engine$1$1.run(Engine.java:85)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: Cannot run program "git" (in directory "C:\home\Evo"): CreateProcess error=2, The system cannot find the file specified
	at java.lang.ProcessBuilder.start(Unknown Source)
	at hudson.Proc$LocalProc.<init>(Proc.java:240)
	at hudson.Proc$LocalProc.<init>(Proc.java:212)
	at hudson.Launcher$LocalLauncher.launch(Launcher.java:815)
	at hudson.Launcher$ProcStarter.start(Launcher.java:381)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1748)
	... 16 more
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
	at java.lang.ProcessImpl.create(Native Method)
	at java.lang.ProcessImpl.<init>(Unknown Source)
	at java.lang.ProcessImpl.start(Unknown Source)
	... 22 more
ERROR: null


Thank you.
Do you have any ideas of what is going wrong with the plugin.

Mark Waite

unread,
Sep 20, 2016, 1:35:02 PM9/20/16
to Jenkins Users
You need to define the location of the git command on your Windows agent.  Usually that is in C:\Program Files\Git\bin\git.exe.

Look in the "Tool Locations" section of the agent configuration page.

Mark Waite

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/4104667c-6c5d-4b1c-9c80-2de61efffd57%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Steve K

unread,
Sep 20, 2016, 2:19:10 PM9/20/16
to Jenkins Users


Thanks Mark.  That does seem to have done the trick.
I had added the Git location on a Global basis (via. Manage Jenkins --> Configure System) but that didn't help.
I'm a little disappointed that I have to deal with this on a per-agent basis (we didn't need to do that when using a v1.625.3 Windows master),
but, if it works, it works.

Thanks again.

Steve K.

Mark Waite

unread,
Sep 20, 2016, 2:41:45 PM9/20/16
to Jenkins Users
If you use the Git for Windows installer, it offers 3 choices for how you can modify your PATH to include git.  If you install in "Program Files" (rather than a thumbdrive install) and choose to at least be able to run git from the Windows command prompt (the middle choice), then you shouldn't need any further configuration globally or locally.

If you choose to not modify the PATH to allow Windows command prompt to run git, then the git plugin doesn't (currently) attempt to make guesses about the location of the git executable.

Mark Waite

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.

Steve K

unread,
Sep 20, 2016, 2:58:46 PM9/20/16
to Jenkins Users
Thanks Mark.
That's interesting, because I did modify the agent's configuration to add the Git executable's directory to the %PATH% environment variable.
Prior to that, the Git commands did not work from within a build step either.
It would seem that, with Git's bin directory in the PATH, the plugin should be able to execute it.
Steve K.
Reply all
Reply to author
Forward
0 new messages