gitjenkins

Jenkins and Git integration on local git server


I am trying to set up a jenkins/git server.

I have created an empty repo at /home/git/repositories/TestProject, with recursive RW permissions granted to the jenkins user.

I am using file:///home/git/repositories/TestProject as my GIT URL, but getting this error:

Failed to connect to repository : Command "/usr/local/bin/git -c core.askpass=true ls-remote -h file:///home/git/repositories/TestProject HEAD" returned status code 128:
stdout:
stderr: fatal: '/home/git/repositories/TestProject' does not appear to be a git repository
fatal: Could not read from remote repository.

I have also cloned the Elasticsearch Github repo and the same error still shows up.

What am I doing wrong?


Solution

  • I have created an empty repo at /home/git/repositories/TestProject

    How?

    A git init /home/git/repositories/TestProject should create a .git folder in the TestProject folder, and a git -C /home/git/repositories/TestProject status should return a status.

    If you don't see a .git folder in /home/git/repositories/TestProject, that would explain the error message.

    The other reason is an access issue.
    The OP Saichovsky confirms in the comments:

    /home/git was owned by root.
    Looks like the jenkins user ought to have read permissions on all parent (or grandparent) directories.