与Jenkins一起使用Git,并使用私有Git回购

与Jenkins一起使用Git,并使用私有Git回购,git,jenkins,Git,Jenkins,我很难让Git和Jenkins一起工作。我已经在windows 2008服务器机器上使用gitblit设置了一个私有git repo。我在gitblit中创建了一个帐户供jenkins使用,即用户名:jenkins,密码:password,公司:test。我已经创建了证书,并允许使用ssh和https进行访问 使用命令提示符,我可以通过在命令行中键入以下命令来实现克隆: git clone ssh://jenkins@repo.test.com:29418/testrepo/WebApp.git

我很难让Git和Jenkins一起工作。我已经在windows 2008服务器机器上使用gitblit设置了一个私有git repo。我在gitblit中创建了一个帐户供jenkins使用,即用户名:jenkins,密码:password,公司:test。我已经创建了证书,并允许使用ssh和https进行访问

使用命令提示符,我可以通过在命令行中键入以下命令来实现克隆:

git clone ssh://jenkins@repo.test.com:29418/testrepo/WebApp.git c:\test
上面的命令要求我在检索代码之前输入密码。由于我试图在Jenkins中编写此脚本,我尝试:

git clone ssh://jenkins:password@valrepo.test.com:29418/testrepo/WebApp.git c:\test
但我得到了以下错误:

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.
fatal: unable to access 'https://jenkins@valrepo.test.com/r/testrepo/WebApp.git/': SSL certificate problem: self signed certificate in certificate chain
好吧,让我试试https命令。因此,我尝试以下方法:

git https://jenkins@valrepo.test.com/r/testrepo/WebApp.git C:\test
但出现以下错误:

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.
fatal: unable to access 'https://jenkins@valrepo.test.com/r/testrepo/WebApp.git/': SSL certificate problem: self signed certificate in certificate chain
所以我想为什么不试试sslVerify=false命令。我在命令提示符中尝试以下操作:

git -c http.sslVerify=false clone https://jenkins@valrepo.test.com/r/testrepo/WebApp.git C:\test
它在命令提示符下工作。然而,当我在Jenkins中尝试将其作为脚本命令时,Jenkins只是挂起而没有下载任何东西。不知道为什么

我尝试过的其他事情是使用内置Git插件,但我也无法让它工作


我对如何在詹金斯做到这一点已经没有什么想法了。任何人都有经验吗?

我可以通过使用PSEXEC Jenkins登录系统帐户并使用以下命令将证书添加到git repo来修复它:

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