I am having trouble getting Git to work with Jenkins. I've setup a private git repo using gitblit on a windows 2008 server machine. I've created an account in gitblit to be used by jenkins (ie: username: jenkins, password: password, company: test). I've created the certificates and allowed access using both ssh and https.
Using the command prompt, I am able to get cloning to work by typing the following command in command line:
git clone ssh://jenkins@repo.test.com:29418/testrepo/WebApp.git c:\test
The above command asks me for a password before retrieving the code. Since I am trying to script this in Jenkins, I try:
git clone ssh://jenkins:password@valrepo.test.com:29418/testrepo/WebApp.git c:\test
but I get the following error:
ssh: Could not resolve hostname jenkins: no address associated with name
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
Well ok, so let me try the https command. So I try the following:
git https://jenkins@valrepo.test.com/r/testrepo/WebApp.git C:\test
but got the following error:
fatal: unable to access 'https://jenkins@valrepo.test.com/r/testrepo/WebApp.git/': SSL certificate problem: self signed certificate in certificate chain
So I figure why not try the sslVerify=false command. I give the following a try in the command prompt:
git -c http.sslVerify=false clone https://jenkins@valrepo.test.com/r/testrepo/WebApp.git C:\test
and it works in the command prompt. However, when I try it in Jenkins as a script command, Jenkins just ends up hanging without downloading anything. No idea why.
Other things that I have tried is to use the built-in Git plugin, but I cannot get that to work either.
I am running out of ideas on how to get this to work in Jenkins. Anyone have any experience?
I was able to fix it by login in as the SYSTEM account using PSEXEC (Jenkins runs under system account) and adding the certificate to the git repo using the following commands:
git config --global http.sslCert path/to/jenkins.pem
openssl rsa -in path/to/jenkins.pem -out path/to/jenkins.key
git config --global http.sslKey path/to/jenkins.key
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.