Cannot run program "git"

547 views
Skip to first unread message

itchymuzzle

unread,
Oct 18, 2017, 1:41:19 PM10/18/17
to Jenkins Users

https://issues.jenkins-ci.org/browse/JENKINS-40192 Seems like this issue, but I'm not using Docker.


Jenkins master is AWS Linux, agent is AWS Windows Server 2012


Git is in my PATH, and when I am in the workspace I am able to run git from the command line.

 

Cloning the remote Git repository

Cloning repository g...@bitbucket.org:XXXXXXXX/web-application-library.git

 > git init C:\Jenkins\workspace\Build_Web_App_Library # timeout=10

 

ERROR: Error cloning remote repo 'origin'

hudson.plugins.git.GitException: Could not init C:\Jenkins\workspace\Build_Web_App_Library

 

Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from ec2-54-174-233-xx.compute-1.amazonaws.com/54.174.233.xx:62490

 

Caused by: hudson.plugins.git.GitException: Error performing command: git init C:\Jenkins\workspace\Build_Web_App_Library

 

Caused by: java.io.IOException: Cannot run program "git" (in directory "C:\Jenkins\workspace\Build_Web_App_Library"): CreateProcess error=2, The system cannot find the file specified

Mark Waite

unread,
Oct 18, 2017, 1:49:45 PM10/18/17
to Jenkins Users
The PATH used by the agent is probably different than the PATH used by your command line login.

You can report the PATH used by the agent from a freestyle job running on that agent.  The batch step would be:

    SET PATH

That should show you that the PATH defined for the agent does not include the git bin, cmd, or usr\bin directories.

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/94420efe-fb1c-4878-b3a2-d7a6670a3e06%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

itchymuzzle

unread,
Oct 18, 2017, 3:48:30 PM10/18/17
to Jenkins Users
Created "Managed powershell" script using "Managed files" plugin.  Which contained
  $env:Path.split(";")
Created freestyle project, to run the script.
The result showed the exact same result, as doing this on the command line, with the exception of the last item.  Which happened to be the one for Git.
Update the value for PATH by moving the entry for Git, so it wasn't last.  
Had to kill the window in which the agent.jar was started, and start it in a new one, to get the new Path value.
Then the freestyle project returned the exact same value for Path.
Something about how the Git installer updated the value for Path, was wrong/not liked.

itchymuzzle

unread,
Oct 18, 2017, 5:39:02 PM10/18/17
to Jenkins Users
Agh.  I didn't stop/start the agent.jar after installing Git.  So when I ran the freestyle project it only had access to the previous value for Path.  User error.
Reply all
Reply to author
Forward
0 new messages