cant checkout external git repo in jenkins
I have jenkins on openshift. I can do following and it works.
[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 email@example.com Warning: Permanently added 'github.com,220.127.116.11' (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.
So it does connect to github…even I cloned it worked from shell.
- ssh key stops functioning after a while
- How to install Lambda function on AWS?
- Easy way to have 2 GitHub profiles on my computer?
- gitolite: can connect via ssh, can't clone
- SSH Online Code Editor Terminal Security Issue
- Cannot push to Heroku because key fingerprint
But when I try to add repo to a jenkins job it gives following error. Its a private repo.
Failed to connect to repository : Command "git ls-remote -h firstname.lastname@example.org:<USER>/test.git HEAD" returned status code 128: stdout: stderr: Host key verification failed. fatal: The remote end hung up unexpectedly
One Solution collect form web for “cant checkout external git repo in jenkins”
Jenkins is probably running as
jenkins and you accepted the host key for
<USER> you can confirm this by adding the command
whoami to your build steps and confirm the user in
jenkins is different from the one in the shell.
One solution is to login as
jenkins and accept the the key for github.
Another is to copy the line from ~/.ssh/known_hosts of github and copy it to the known_hosts in the jenkins folder ~jenkins/.ssh/known_hosts.