I'm trying to get Jenkins up and running with a GitHub hosted repository (using the Jenkins Git plugin). The repository has multiple git submodules, so I'm not sure I want to try and manage multiple deploy keys.
My personal GitHub user account is a collaborator of each of the projects I wish to pull in with Jenkins, so I've generated an SSH key within /var/lib/jenkins/.ssh
and added it to my personal GitHub account.
However, when I try and add the repository URL to my Jenkins project configuration, I get:
Failed to connect to repository : Command "git ls-remote -h [email protected]:***/***.git HEAD" returned status code 128:
stdout:
stderr: Host key verification failed.
fatal: The remote end hung up unexpectedly
Likewise, when I schedule a build I get:
stderr: Host key verification failed.
fatal: The remote end hung up unexpectedly
I've also tried setting up an SSH config file as outlined here, but to no avail.
Can anyone shed any light? Thanks
EDIT
I should add that I'm running CentOS 5.8
This question is related to
git
ssh
jenkins
continuous-integration
Have you tried logging in as the jenkins user?
Try this:
sudo -i -u jenkins #For RedHat you might have to do 'su' instead.
git clone [email protected]:your/repo.git
Often times you see failure if the host has not been added or authorized (hence I always manually login as hudson/jenkins for the first connection to github/bitbucket) but that link you included supposedly fixes that.
If the above doesn't work try recopying the key. Make sure its the pub key (ie id_rsa.pub). Maybe you missed some characters?
According to this article, you may try following command:
ssh-add -l
If your key isn't in the list, then
ssh-add /var/lib/jenkins/.ssh/id_rsa_project
This works for me if you have config and the private key file in the /Jenkins/.ssh/ you need to chown (change owner) for these 2 files then restart jenkins in order for the jenkins instance to read these 2 files.
Source: Stackoverflow.com