小编典典

Jenkins 主机密钥验证失败

all

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

在 Jenkins 下登录

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 存储库。 *

感谢帮助!


阅读 127

收藏
2022-08-01

共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 中收到此错误。

2022-08-01