繁体   English   中英

无法在詹金斯结帐外部git repo

[英]cant checkout external git repo in 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克隆它也可以。

但是,当我尝试将回购添加到詹金斯工作时,会出现以下错误。 它是一个私人仓库。

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>的主机密钥,可以通过在构建步骤中添加命令whoami来确认这一点,并确认jenkins的用户与shell中的用户不同。

一种解决方案是以jenkins身份登录并接受github的密钥。

另一个方法是从github的〜/ .ssh / known_hosts复制该行,并将其复制到jenkins文件夹〜jenkins / .ssh / known_hosts中的known_hosts。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM