Jenkins 主机密钥验证失败 [英] Jenkins Host key verification failed

查看:53
本文介绍了Jenkins 主机密钥验证失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 jenkins 时遇到问题,设置git",显示以下错误:

I have a problem with jenkins, setting "git", shows the following error:

Failed to connect to repository : Command "git ls-remote -h https://person@bitbucket.org/person/projectmarket.git HEAD" returned status code 128:
stdout:
stderr: fatal: Authentication failed

我已经用 ssh 测试过:

git@bitbucket.org:person/projectmarket.git

这是错误:

Failed to connect to repository : Command "git ls-remote -h git@bitbucket.org:person/projectmarket.git HEAD" returned status code 128:
stdout:
stderr: Host key verification failed.
fatal: The remote end hung up unexpectedly

我也使用SSH 密钥"完成了这些步骤.

I've also done these steps with "SSH key".

在Jenkins下登录

Login under Jenkins

sudo su jenkins

将你的 github 密钥复制到 Jenkins .ssh 文件夹

Copy your github key to Jenkins .ssh folder

cp ~/.ssh/id_rsa_github* /var/lib/jenkins/.ssh/

重命名密钥

mv id_rsa_github id_rsa
mv id_rsa_github.pub id_rsa.pub

但仍然无法在 jenkins 中使用 git 存储库.

but still not working git repository in jenkins.

感谢帮助!

推荐答案

更改为 jenkins 用户并手动运行命令:

Change to the jenkins user and run the command manually:

git ls-remote -h git@bitbucket.org:person/projectmarket.git HEAD

首次通过 SSH 连接到新主机时,您将收到标准 SSH 警告:

You will get the standard SSH warning when first connecting to a new host via SSH:

The authenticity of host 'bitbucket.org (207.223.240.181)' can't be established.
RSA key fingerprint is 97:8c:1b:f2:6f:14:6b:5c:3b:ec:aa:46:46:74:7c:40.
Are you sure you want to continue connecting (yes/no)?

输入 yes 并按 Enter.bitbucket.org 的主机密钥现在将添加到 ~/.ssh/known_hosts 文件中,您将不会再在 Jenkins 中收到此错误.

Type yes and press Enter. The host key for bitbucket.org will now be added to the ~/.ssh/known_hosts file and you won't get this error in Jenkins anymore.

这篇关于Jenkins 主机密钥验证失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆