gpt4 book ai didi

git - 无法在 jenkins 中 checkout 外部 git repo

转载 作者:行者123 更新时间:2023-12-02 14:39:27 24 4
gpt4 key购买 nike

我在 openshift 上有 Jenkins 。我可以进行以下操作,并且可以。

[jenkins-<USER>.rhcloud.com data]\> ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /var/lib/openshift/<NUMBERED DIRECTORY>/app-root/data/.ssh/jenkins_id_rsa git@github.com
Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts.
PTY allocation request failed on channel 0
Hi <USER>! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.

所以它确实连接到 github ......即使我从 shell 克隆了它。

但是,当我尝试将 repo 添加到 jenkins 作业时,它会出现以下错误。它是一个私有(private) repo 。
Failed to connect to repository : Command "git ls-remote -h git@github.com:<USER>/test.git HEAD" returned status code 128:
stdout:
stderr: Host key verification failed.
fatal: The remote end hung up unexpectedly

最佳答案

Jenkins 可能以 jenkins 的身份运行并且您接受了 <USER> 的主机 key 您可以通过添加命令 whoami 来确认这一点到您的构建步骤并在 jenkins 中确认用户与外壳中的不同。

一种解决方案是登录为 jenkins并接受 github 的 key 。

另一种是从github的~/.ssh/known_hosts中复制这行,复制到jenkins文件夹~jenkins/.ssh/known_hosts中的known_hosts中。

关于git - 无法在 jenkins 中 checkout 外部 git repo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15413414/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com