[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

2 Answers 2


... and you have requested strict checking.

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


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.


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

Login before any add to the know_hosts using :

sudo su - jenkins
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.