jenkins 如何解决known_hosts文件不存在?

vd8tlhqk  于 2023-06-21  发布在  Jenkins
关注(0)|答案(1)|浏览(554)

我正在运行一个与Docker主机通信的Jenkins容器。我创建了一个管道来利用GitHub存储库。但是当我进行构建时,它给出了一个错误,并在日志中显示以下消息:

using GIT_SSH to set credentials 
Verifying host key using known hosts file
You're using 'Known hosts file' strategy to verify ssh host keys, but your known_hosts file does not exist, please go to 'Manage Jenkins' -> 'Configure Global Security' -> 'Git Host Key Verification Configuration' and configure host key verification.

我在容器中生成了ssh密钥。我添加了github上的公钥和用于构建的git用户的私钥。
在容器中,生成的密钥位于路径中:/root/.ssh/
我在容器中运行以下命令来测试与github的通信:ssh -T git@github.com

    • 命令输出**:你好campos!你已经成功通过身份验证,但GitHub不提供shell访问。

我不理解这个错误。你能帮我吗?

brqmpdu1

brqmpdu11#

在管道中,我将master更改为main。这就解决了问题。

相关问题