I'm having an issue right now trying to set up a Jenkins job (on one Windows server) to monitor an internal Git repo located on a Gitosis server (on a different Windows server).
The url looks like this: ssh://[email protected]:relative_path/repo.git (real values replaced for security, also the relative path will not work with a '~/', it only works without a leading '/').
When running git clone from the command line with the url, everything comes out fine.
When configuring a Git SCM in the Jenkins job it is able to run an ls-remote command (this confirms that the ssh keys are properly configured for the Jenkins instance).
However when the job executes, the url appears to be rewritten with an additional forward slash which causes the clone command to fail.
Started by user Meh
[EnvInject] - Loading node environment variables.
Building in workspace D:\local_repo_test
> git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git.exe config remote.origin.url ssh:///[email protected]:relative_path/repo.git # timeout=10
Fetching upstream changes from ssh:///[email protected]:relative_path/repo.git
> git.exe --version # timeout=10
> git.exe -c core.askpass=true fetch --tags --progress ssh:///[email protected]:relative_path/repo.git +refs/heads/*:refs/remotes/origin/*
ERROR: Error fetching remote repo 'origin'
ERROR: Error fetching remote repo 'origin'
Finished: FAILURE
It's the '///' that bothers me. Has anyone seen anything like this?
Any help on this would be appreciated.
Since I couldn't make any traction with the Jenkins people on trying to address why the url gets rewritten with '///' and I also couldn't determine if anything was wrong with Gitosis I figured out a work around.
Since Cygwin, SSH, and Gitosis were already installed and running I decided to add a new user to the machine and run all the git ssh command through it.
Followed the steps here to add a new user http://techtorials.me/cygwin/create-and-add-users/
Then I chmod'ed and chgrp'ed /home/git/reposotories to the sshUsers group. Once that was in place I was able to use a Git SSH url with an absolute path name bypassing the '///' url issue with jenkins.