1

I'm setting up Jenkins on my windows build machine, with the Git Plugin. I'm using a directory on a network drive Z: as the git repository for now. I enter "z:\my\repo\path" for the Repository URL, and I get:

Failed to connect to repository : Command "git.exe -c core.askpass=true ls-remote -h z:\my\repo\path HEAD" returned status code 128:
stdout:
stderr: fatal: 'z:\my\repo\path' does not appear to be a git repository
fatal: Could not read from remote repository.

Yet if I open a fresh command prompt and type that command, it works without error (and also no output):

> git.exe -c core.askpass=true ls-remote -h z:\my\repo\path HEAD
> 

What may possibly be the issue? I am not even sure where to begin. I've set the PATH and GIT_HOME system environment variables and restarted Jenkins, so clearly it is finding the executable.

I've tried the file:///-style path and had the same results.


Output of the manual command with GIT_CURL_VERBOSE=1 and GIT_TRACE=1 set:

15:43:24.905801 git.c:348               trace: built-in: git 'ls-remote' '-h' 'z:\\my\\repo\\path' 'HEAD'
15:43:24.905801 run-command.c:343       trace: run_command: 'git-upload-pack '\''z:\\my\\repo\\path'\'''
Claudiu
  • 224,032
  • 165
  • 485
  • 680
  • Which user does Jenkins run as? – Ashutosh Jindal Dec 16 '15 at 20:21
  • Could you please post the output of the manual command with the following vars set: `GIT_CURL_VERBOSE=1 GIT_TRACE=1 git.exe -c ...` – Ashutosh Jindal Dec 16 '15 at 20:33
  • @AshutoshJindal: Certainly, see the update. It runs as the "Local System account". Changing it to use the same user as when I manually enter the command didn't fix the problem. – Claudiu Dec 16 '15 at 20:46
  • Have you changed anything else than "Repository URL" in your scm settings? – SevenEleven Dec 16 '15 at 20:53
  • @SevenEleven: Nope, just installed the plugin, selected "Git" from the project settings, and entered the folder path – Claudiu Dec 16 '15 at 20:53
  • Ahhhh intriguing - I failed to mention that `z:\` is a network drive, and [this answer](http://stackoverflow.com/questions/7410793/unable-to-get-jenkins-and-git-to-play-nice) indicates that I have to specify the full path... trying to get this to work now – Claudiu Dec 16 '15 at 20:58
  • Yes, that was it. `//network-host-name/path/to/repo` worked. – Claudiu Dec 16 '15 at 20:59
  • ah sorry, I should have been more explicit, that's what I meant by the 'UNC' path. Updating with link now – Ashutosh Jindal Dec 16 '15 at 21:00

1 Answers1

1

I believe the problem could be around correctly setting up the SSH keys.

First suggestion - UNC path for the repo

Can you try using the file://// format for the repo instead of windows path?

If it's a share try using git clone file:////<host>/<share>/<path> instead.

Please use this as reference.

Second suggestion - SSH Keys

From https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin#GitPlugin- : (though the error is different that what you have)

Some windows fun

If you did everything, you should now have a ~/.ssh folder (c:\Users\Bob.ssh for instance) and this folder contains your keys. At that point, you may even be able to manually (from the console), clone your repository but Jenkins keeps failing with something like this:

code 128: Cloning into C:\Program Files\Jenkins\jobs\PG3\workspace... fatal: The remote end hung up unexpectedly

If you run into this issue, you may need to copy the id_rsa* files from your ~./.ssh to another folder. Find your git.exe and check if there is an .ssh folder there. If so, copy ~./ssh/id_rsa* to this folder and try again.

Community
  • 1
  • 1
Ashutosh Jindal
  • 18,501
  • 4
  • 62
  • 91