1

I've set a Jenkins server running on Red Hat up with a windows agent via ssh. (Openssh installed via Cygwin https://docs.oracle.com/cd/E24628_01/install.121/e22624/preinstall_req_cygwin_ssh.htm#EMBSC152)

I set the PATH on the windows machine itself, and also set it on Cygwin and in an ssh session from the same user via this command:

export "PATH=$PATH:/cygdrive/c/Program Files/Git/cmd"

After this I can use git commands but if I exit the ssh session and re-ssh to the box on the same user that Jenkins authenticates through I'm still having trouble on the git step:

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

I then tried adding that command in a shell script build step before git is called using this plugin: https://wiki.jenkins.io/display/JENKINS/pre-scm-buildstep

Then I tried adding the PATH to the bashrc file for the user Jenkins is logging in as. Now I can re-ssh to the box and git commands work but Jenkins is still getting the same error. What can I do?

Here's part of a log of the Jenkins build. I'm echoing the path right before git is called:

$ sh -xe C:\Users\me\me8302631688845790141.sh + echo /usr/bin:/cygdrive/c/Program Files '(x86)/Common' Files/Oracle/Java/javapath:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Users/cyg_server/AppData/Local/Microsoft/WindowsApps:/cygdrive/c/Program Files/Git/cmd /usr/bin:/cygdrive/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Users/cyg_server/AppData/Local/Microsoft/WindowsApps:/cygdrive/c/Program Files/Git/cmd Success build forhudson.tasks.Shell@10d22911 Cloning the remote Git repository Cloning repository https://url.git

git init C:\cygdrive\c\me\workspace\app# timeout=10 ERROR: Error cloning remote repo 'origin'

b15
  • 2,101
  • 3
  • 28
  • 46
  • Finally found the answer here: https://stackoverflow.com/questions/37155321/error-error-cloning-remote-repo-origin – b15 Jul 13 '18 at 14:29

0 Answers0