Jenkins 因 github“git clone”失败
当我在 Jenkins 中构建时,它会因此错误而失败。有什么想法吗?
ERROR: Error cloning remote repo 'origin' : Could not clone [email protected]:test/test.git
ERROR: Cause: Error performing command: git clone --progress -o origin
[email protected]:test/test.git /var/lib/jenkins/jobs/test/workspace
Command "git clone --progress -o origin [email protected]: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
When I do build in Jenkins, it fails with this error. Any idea?
ERROR: Error cloning remote repo 'origin' : Could not clone [email protected]:test/test.git
ERROR: Cause: Error performing command: git clone --progress -o origin
[email protected]:test/test.git /var/lib/jenkins/jobs/test/workspace
Command "git clone --progress -o origin [email protected]: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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
主机密钥验证失败。 - 确保您的 SSH 密钥设置正确。
http://help.github.com/linux-set-up-git/
完成后,
应该会从 GitHub 给您一条欢迎消息(也表示没有 shell 访问权限)
Host key verification failed. - make sure your SSH keys are setup properly.
http://help.github.com/linux-set-up-git/
After you are done with that,
should give you a welcome message ( which also says no shell access ) from GitHub
即使 ssh 密钥设置正确,也有同样的问题。
问题是,在第一次连接尝试时,需要将 git-server 添加到已知的主机文件中
。 Git 在第一次连接尝试时会提示您:您确定要继续连接吗(是/否)?,但 Jenkins 没有也无法传递提示,所以它默默地失败了。
我们通过走到我们的操作员那里,给他带来一杯好喝的浓缩咖啡,并让他随机进行 git-checkout 来解决这个问题,他对上述提示回答是 :) 之后,通过 Jenkins 的结账按预期进行。
在这里找到线索: http://www.ipsure.com/blog/2010/ssh-public-key-w-rsa-authentication-and-ssh-tunneling-part-1/
Had the same problem, even though the ssh-keys were correctly set up.
The issue was that on the first connection attempt, the git-server needed to be added to the known hosts file
. Git prompts you for this on first connect-attempt: Are you sure you want to continue connecting (yes/no)?, but Jenkins did not nor can it pass on the prompt, so it failed silently.
We solved it by walking to our ops-guy, bringing him a nice cup of espresso, and had him do a random git-checkout, where he answered yes to said prompt :) After that, checkouts through Jenkins worked as expected.
Found the clue here: http://www.ipsure.com/blog/2010/ssh-public-key-w-rsa-authentication-and-ssh-tunneling-part-1/
如果您仍然遇到主机密钥验证失败问题,我在这里通过逐步解决方案回答了类似的问题:
詹金斯和Github 不使用 SSH 密钥
If you still have the Host key verification failed problem I answered a similar problem with a step by step solution here :
Jenkins & Github not using SSH Key
实际上,我最终只是使用 https 而不是 ssh 将存储库从 GitHub 克隆到 Jenkins。
因此,不要使用:
[email protected]:[user]/ [repository].git
我使用:https://github.com/[user]/[repository].git
作为存储库 URL。Actually, I ended up with simply using https instead of ssh to clone the repository from GitHub to Jenkins.
So instead of:
[email protected]:[user]/[repository].git
I used:https://github.com/[user]/[repository].git
as the repository URL.您需要将您的私有 ssh 密钥复制到 Jenkins 下的
.ssh
文件夹中。类似于(在 Ubuntu Lucid 上):/var/lib/jenkins/.ssh
You need to copy your private ssh key into the
.ssh
folder beneath Jenkins. Something like (on Ubuntu Lucid):/var/lib/jenkins/.ssh