6

[enter image description here]

1Failed to connect to repository : Command "git ls-remote -h -- git@github.com:yeni/jenkins-terraform.git HEAD" returned status code 128: stdout: stderr: No ECDSA host key is known for github.com and you have requested strict checking. Host key verification failed. fatal: Could not read from remote repository.

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

i am getting this error when I try to connect GitHub repo with Jenkins. Let me know how to solve it

issue image

user2631106
  • 61
  • 1
  • 1
  • 3

3 Answers3

23

... and you have requested strict checking.

You can check the Jenkins/Git-Host-Key-Verification setting under Global Security...

Jenkins/Git-Host-Key-Verification-Configuration

Obviously you can workaround it by selecting No verification which is not at all recommended though.

In case you want to use Known hosts file verification, you can pre-populate the SSH keys for each server, using the below command (on Linux)...

ssh-keyscan github.com >> ~/.ssh/known_hosts

You have to do that on the user-account that Jenkins is running with.

There is this similar StackOverflow thread "Jenkins Host key verification failed", where other solutions are mentioned, alongside the above.

idrositis
  • 331
0

as mentioned in StackOverflow thread "Jenkins Host key verification failed" don't forget to populate the jenkins user's known_hosts file !

Login before any add to the known_hosts using :

sudo su - jenkins
0

I have run the following command after logging into the Jenkins container as the jenkins user, to get an automated host key entry in the known_hosts file.

ssh -T git@github.com

And that fixed it.

Tonmoy
  • 101