Jenkins用github“git clone”失败了

时间:2011-05-23 22:19:18

标签: 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

5 个答案:

答案 0 :(得分:23)

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

答案 1 :(得分:15)

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

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

完成后,

ssh git@github.com

应该从GitHub

给你一条欢迎信息(也说没有shell访问权限)

答案 2 :(得分:6)

即使正确设置了ssh-key,也存在同样的问题。

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

  

/。SSH / known_hosts中

。 Git会在第一次连接尝试时提示您: 您确定要继续连接(是/否)吗? ,但Jenkins没有也不能传递提示,所以它无声地失败了。

我们通过走到我们的操作员那里解决了这个问题,为他带来了一杯浓咖啡,让他做了一个随机的git-checkout,在那里他回答 提示:)之后,通过Jenkins的结账按预期工作。

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

答案 3 :(得分:2)

如果您仍然主机密钥验证失败问题,我在此处逐步解决了类似的问题:

Jenkins & Github not using SSH Key

答案 4 :(得分:0)

实际上,我最终只使用https而不是ssh将存储库从GitHub克隆到Jenkins。

因此,我使用git@github.com:[user]/[repository].git作为存储库网址而不是:https://github.com/[user]/[repository].git