一尘不染

Jenkins主机密钥验证失败

jenkins

我的 詹金斯(Jenkins) 有问题,设置为“ git”,显示以下错误:

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密钥”完成了这些步骤。

在詹金斯下登录

sudo su jenkins

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

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 仓库。 *

感谢帮助!。


阅读 545

收藏
2020-07-25

共1个答案

一尘不染

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

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

首次通过SSH连接到新主机时,您将获得标准的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中收到此错误。

2020-07-25