Search code examples
gitjenkins

Jenkins: Error connecting to a GIT repository


I am having trouble connecting to a GIT repository from Jenkins. In my jobs configuration I specified the "Repository" URL" to "xxx@yyy:/usr/data/git/common/ast.git" and get the following error:

Failed to connect to repository : Command "/usr/data/git-client/bin/git ls-remote -h xxx@yyy:/usr/data/git/common/ast.git HEAD" returned status code 128:
stdout:
stderr: fatal: Unable to read current working directory: No such file or directory

When I run the command "/usr/data/git-client/bin/git ls-remote -h xxx@yyy:/usr/data/git/common/ast.git HEAD" from the shell as the user Jenkins runs as I do not get an error.

What is the problem from Jenkins? How can I find out which directory Jenkins is refering to?

Edit:

I have switched on Jenkins logging for the jenkins-git-plugin but it does not tell me which directory it can not access.

When I start Jenkins as root everything works nicely - so it is definitly a file system access problem - I just do not know which directory git needs access to or how to find out.


Solution

  • This is working now. I am not completely sure what fixed it but it maybe that some directoy premissions somewhere under my Jenkins Home directory where screwed up. I did run

    chown -R jenkins_user:xxx *
    

    in the Jenkins Home dir and now it works.