Failed to connect to repository : Command "/usr/bin/git ls-remote -h file:///home/myuser/path/to/project HEAD" returned status code 128:
stderr: fatal: 'home/myuser/path/to/project' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
/usr/bin/git ls-remote -h file:///home/myuser/path/to/project HEAD
git ls-remote -h ...
git clone ...
Jenkins as a service, by default,
Jenkins does not create a user directory as in:
/home/jenkins. Jenkins default home directory is set to
/var/lib/jenkins. From my work-around, as you would expect,
jenkins has trouble accessing local resources from other users directory.
I moved my cloned repo under Jenkins default home directory i.e. under
/var/lib/jenkins so my
Repository URLin Jenkins Project configuration looks like:
UPDATE: The above works fine ...but I found a better way to do it from this blog
The steps are outlined here:
/etc/init.d/jenkins script. There are a few
$JENKINS variables defined
. This should lead you to the
sysconfig for jenkins i.e.
Stop your jenkins instance:
sudo /sbin/service jenkins stop
Take a backup
cp /etc/sysconfig/jenkins /etc/sysconfig/jenkins.bak
In this file, change the following property:
$JENKINS_USER="<your desired user>"
Change ownership of all related Jenkins directories:
chown -R <your desired user>:<your user group> /var/lib/jenkins
chown -R <your desired user>:<your user group> /var/cache/jenkins
chown -R <your desired user>:<your user group> /var/log/jenkins
Restart jenkins and that error should disappear
sudo /sbin/service jenkins start
This error should go away now!