Jenkins 因 github“git clone”失败

发布于 2024-11-08 22:19:11 字数 1018 浏览 0 评论 0原文

当我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

短叹 2024-11-15 22:19:12

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

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

完成后,

ssh [email protected]

应该会从 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,

ssh [email protected]

should give you a welcome message ( which also says no shell access ) from GitHub

很酷不放纵 2024-11-15 22:19:12

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

问题是,在第一次连接尝试时,需要将 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/

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

/.ssh/known_hosts

. 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/

空城仅有旧梦在 2024-11-15 22:19:12

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

詹金斯和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

自找没趣 2024-11-15 22:19:12

实际上,我最终只是使用 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.

故事灯 2024-11-15 22:19:11

您需要将您的私有 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文