Jenkins用github"git clone"失败了

Sam*_*Sam 21 github jenkins

当我在Jenkins中构建时,它会因此错误而失败.任何的想法?

ERROR: Error cloning remote repo 'origin' : Could not clone git@github.com:test/test.git
ERROR: Cause: Error performing command: git clone --progress -o origin 

git@github.com:test/test.git /var/lib/jenkins/jobs/test/workspace
Command "git clone --progress -o origin git@github.com:test/test.git 
/var/lib/jenkins/jobs/test/workspace" returned status code 128: Initialized empty Git 
repository in /var/lib/jenkins/jobs/test/workspace/.git/

No protocol specified

(ssh-askpass:801): Gtk-WARNING **: cannot open display: :0.0
Host key verification failed.
fatal: The remote end hung up unexpectedly
Run Code Online (Sandbox Code Playgroud)

Hed*_*hog 23

您需要将私有ssh密钥复制到.sshJenkins下面的文件夹中.像(在Ubuntu Lucid上): /var/lib/jenkins/.ssh

  • 更好的是,不要将您的私钥放在除您自己的主目录之外的其他地方.为jenkins创建一组新密钥,并将jenkins公钥提供给github. (20认同)
  • 您需要将复制的文件chown到/ var/lib/jenkins中.此外,您可能希望将.gitconfig文件复制到/ var/lib/jenkins中 (4认同)

man*_*lds 15

主机密钥验证失败. - 确保您的SSH密钥设置正确.

http://help.github.com/linux-set-up-git/

完成后,

ssh git@github.com
Run Code Online (Sandbox Code Playgroud)

应该从GitHub给你一个欢迎消息(也说没有shell访问)

  • 尝试`sudo su jenkins -`然后让它作为Jenkins用户工作.这为我修好了. (4认同)

Fre*_*ing 6

有同样的问题,即使正确设置了ssh-key.

问题是在第一次连接尝试时,需要将git-server添加到已知的hosts文件中

/.ssh/known_hosts

.首次连接尝试时Git会提示您:您确定要继续连接(是/否)?,但詹金斯没有也不能传递提示,所以它默默地失败了.

我们解决了它步行到我们的OPS-家伙,把他的咖啡一杯好,并且让他做一个随机的git结帐,他回答与所述提示:)之后,通过詹金斯检出预期一样.

在这里找到线索:http://www.ipsure.com/blog/2010/ssh-public-key-w-rsa-authentication-and-ssh-tunneling-part-1/