我正在尝试让 Jenkins 启动并运行 GitHub 托管存储库(使用 Jenkins Git 插件)。该存储库有多个 git 子模块,因此我不确定是否要尝试管理多个部署密钥。
我的个人 GitHub 用户帐户是我希望使用 Jenkins 参与的每个项目的协作者,因此我在其中生成了一个 SSH 密钥/var/lib/jenkins/.ssh
并将其添加到我的个人 GitHub 帐户中。
但是,当我尝试将存储库 URL 添加到 Jenkins 项目配置时,我得到:
Failed to connect to repository : Command "git ls-remote -h [email protected] /cdn-cgi/l/email-protection:***/***.git HEAD" returned status code 128:
stdout:
stderr: Host key verification failed.
fatal: The remote end hung up unexpectedly
同样,当我安排构建时,我得到:
stderr: Host key verification failed.
fatal: The remote end hung up unexpectedly
我还尝试按照概述设置 SSH 配置文件here https://web.archive.org/web/20130502014020/blog.firmhouse.com/configuring-multiple-private-ssh-deploy-keys-in-jenkins-for-github-com,但无济于事。
任何人都可以阐明吗?谢谢
EDIT
我应该补充一点,我正在运行 CentOS 5.8
它看起来像github.com
jenkins 尝试连接的主机未在 Jenkins 用户的列表中列出$HOME/.ssh/known_hosts
。 Jenkins 以用户身份在大多数发行版上运行jenkins
并因此有自己的.ssh
存储公钥列表的目录和known_hosts
.
我能想到的解决这个问题的最简单的解决方案是:
# Login as the jenkins user and specify shell explicity,
# since the default shell is /bin/false for most
# jenkins installations.
sudo su jenkins -s /bin/bash
cd SOME_TMP_DIR
# git clone YOUR_GITHUB_URL
# Allow adding the SSH host key to your known_hosts
# Exit from su
exit
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)