我在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作业时,它会出现以下错误。它是一个私人回购。
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
答案 0 :(得分:1)
Jenkins可能以jenkins
运行,并且您接受了<USER>
的主机密钥,您可以通过在构建步骤中添加命令whoami
来确认这一点,并在{{1}中确认用户与shell中的那个不同。
一种解决方案是以jenkins
登录并接受github的密钥。
另一种方法是从github的〜/ .ssh / known_hosts复制该行,并将其复制到jenkins文件夹~jenkins / .ssh / known_hosts中的known_hosts。