I'm having a hard time configuring Jenkins, running as a Windows Service, to connect to a git server (gitosis) and clone a repository. Jenkins is set to use the standard Git plugin.

Everything is hosted by us: the Jenkins server is on win.foo.com and gitosis is running on a linux server (git.foo.com).

If I RDP into win.foo.com I can clone (git.exe clone --progress -o origin git@git.foo.com:myproject.git myproject) from the command line without issue.

Jenkins is running as a service and because it's not running under the same user account I've copied the .ssh folder to %SystemRoot%\System32\config\systemprofile (as defined in the %USERPROFILE% environment variable) and C:\Program Files (x86)\Git\, but neither of these seem to be picked up by Jenkins, even after a full restart.

I've tried using both git.exe and git.cmd; no joy in either case.

Jenkins is failing with the following error message:

ERROR: Error cloning remote repo 'origin' : Could not clone git@git.foo.com:myproject.git
ERROR: Cause: Error performing command: C:\Program Files (x86)\Git\cmd\git.cmd clone --progress -o origin git@git.foo.com:myproject.git C:\Program Files (x86)\Jenkins\jobs\myproject\workspace
Command "C:\Program Files (x86)\Git\cmd\git.cmd clone --progress -o origin git@git.foo.com:myproject.git C:\Program Files (x86)\Jenkins\jobs\myproject\workspace" returned status code 128: Cloning into C:\Program Files (x86)\Jenkins\jobs\myproject\workspace...
Access denied
fatal: The remote end hung up unexpectedly

I'm sure I've missed something, but I'm not sure what.

Advice?

link|improve this question

33% accept rate
@Mchl: quite true, actually... voted to close (migrate to SF) as well. – VonC Aug 4 '11 at 8:36
feedback

migrated from stackoverflow.com Aug 4 '11 at 9:42

This question came from our site for professional and enthusiast programmers.

1 Answer

The only parameter you need to really check is the %HOME% environment variable value, when Jenkins tries to clone.
You need to display the 'set' (environments variable) of the Jenkins session and see if HOME has been defined, and if it has, to which path.

Reminder:

  • Windows, by default, doesn't define HOME
  • msysgit defaults HOME to %USERPROFILE%

To display the variables, use the Parametrized build feature:

Reference parameter by name in builder. I'm using the "env" command to show the variable, followed by an echo statement to demonstrate referencing the value:

command shell in parametrized Jenkins job

link|improve this answer
Any idea how I can view the %HOME% env variable through Jenkins? – Phillip Oldham Aug 4 '11 at 8:15
@unpluggd: I have edited my answer to address your question. – VonC Aug 4 '11 at 8:34
Thanks! Doesn't show that HOME is set though; as you said, HOME isn't set by default. Is it possible to set this? – Phillip Oldham Aug 4 '11 at 9:02
@unpluggd: on Windows, HOME isn't set, that means you have to set it either on the User Environment Variable side, or on the System Environment variable side as in howtogeek.com/51807/… – VonC Aug 4 '11 at 9:34
Still getting access denied! There's no HOME var even though Jenkins is now running as a new user. – Phillip Oldham Aug 4 '11 at 11:28
show 2 more comments
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.