3

I use GitBlit (1.3.2), Jenkins (1.534) on RedHat 6

I created a Git repository on a local GitBlit. Access is restricted to authenticated users. This works fine.

When I try to configure a new job in Jenkins to enable continuous Integration, I enter the Git repository URL as follow:

http://jenkins@myhost.local/gitblit/git/testing/secured_repo.git

I received the error message below and I don't know where to set the jenkins's password...

Failed to connect to repository : Failed to connect to http://jenkins@myhost.local/gitblit/git/testing/secured_repo.git (status = 401)

Help is very welcome!

Destroyica
  • 4,147
  • 3
  • 33
  • 50

3 Answers3

2

You could try including the password in your url:

http://jenkins:password@myhost.local/gitblit/git/testing/secured_repo.git
James Moger
  • 1,721
  • 12
  • 12
2

This should work using Jenkins 1.560 and gitblit 1.5.0 if you add the credentials to Jenkins(Global Credentials) and use JGit(if the installed version of git doesn't support git config --local) You can probably use native git if you have a more recent version(>=1.7.9).

Url would be http://myhost.local/gitblit/git/testing/secured_repo.git

Then either select credentials from the dropdown or add new credentials.

jamesidw
  • 66
  • 8
  • your solution work on my side. thanks. Jenkins 1.643 & Gitblit 1.6.2 – wenbo qiu Jan 06 '16 at 05:35
  • Yes, leaving out the uid:pwd@ from the authority part of the URL and specifying it using Jenkins credentials did the trick for me. So in stead of using the URLhttp://jenkins@myhost.local/gitblit/git/testing/secured_repo.git you should use it without specifying the user http://myhost.local/gitblit/git/testing/secured_repo.git – Bruno Ranschaert Jan 21 '16 at 09:44
0

Use .netrc in folder /var/lib/jenkins

machine host
login user
password yourpassword
Pranav 웃
  • 8,469
  • 6
  • 38
  • 48
biolinh
  • 2,175
  • 1
  • 24
  • 23
  • Good idea the permanent authentication, but unfortunately GitBlit doesn't support this authentication... – Destroyica Dec 06 '13 at 15:17
  • @Destroyica Actually gitblit seems to do exactly that. I'm sitting with the exact same error at the moment and after adding the .netrc file I can clone repositories through the cmd line as the jenkins user. However, it seems the jenkins server still can't. – m__ Dec 06 '13 at 18:28
  • @m__: have you use the git plugin on Jenkins: https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin – biolinh Dec 23 '13 at 06:17