Jenkins 在 github "git clone" 上失败了



当我在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

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

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

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

完成后,

ssh git@github.com

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

即使ssh密钥设置正确,也有同样的问题。

问题是,在第一次尝试连接时,需要将git服务器添加到已知的主机文件中

/.ssh/nknown_hosts

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

我们走到我们的行动人员那里,给他端了一杯很好的意式浓缩咖啡,让他随机结账,他回答yes并提示:)之后,通过詹金斯结账如预期。

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

如果您仍然存在主机密钥验证失败问题,我在这里用逐步解决方案回答了类似的问题:

詹金斯;Github未使用SSH密钥

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

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

最新更新