2
votes

I get Host key verification failed error whenever I try to put my GITLAB git address into Jenkins.

I've tried: - using multiple different SSH paths. Including removing : and replacing /. Used http - I've ssh and tried to run the command in the terminal, when prompted to say y/n I pressed Y. - It works with Github. - I've tried going to my jenkins/.ssh/ida_pub and adding my keys.

Failed to connect to repository : Command "/usr/local/git/bin/git ls-remote -h git@:/.git HEAD" returned status code 128: stdout: stderr: Host key verification failed. fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

1
What version of gitlab are you using?VonC
And did you try to use IP instead of hostname in your config as in github.com/gitlabhq/gitlabhq/issues/2106?VonC

1 Answers

3
votes

If you make the repo you are trying to connect to public in Gitlab (Settings -> Edit Project -> Public mode) you should be able to connect using http (but only http).

If the repo is not public you will need to install an SSH key on Jenkins that has permissions to access the repo. My understanding is that the Jenkins git plugin does not currently use the SSH credentials already stored in Jenkins so you will need to install the key on the master and slaves that will run this build. How you do this will depend on your OS but I find it easiest to use an SSH config file on Linux.