[英]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.