4

[enter image description here]

1Failed to connect to repository : Command "git ls-remote -h -- [email protected]: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

2 Answers 2

21

... 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.

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
4
  • This adds nothing to the previous answer. Dec 6, 2022 at 0:59
  • my bad, this was just to don't forget (as I did at the first place) to update the jenkins'know_hosts file and not the one of the current user used to log into the VM
    – RGuillome
    Dec 7, 2022 at 15:11
  • Do you mean "known_hosts"? I suspect so. Jun 12, 2023 at 18:28
  • Yes thx @Mr.LanceESloan
    – RGuillome
    Jul 17, 2023 at 10:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .