Sep 14, 2018

Fix: "git stderr host key verification failed" in Jenkins

Fix: "git stderr host key verification failed" in Jenkins

You should log into your Jenkins host as the Jenkins user and run:
ssh git@github.com
Then answer yes to the prompt about the host key. This only needs to be done once.

Alternatively but not recommended, you could add "StrictHostKeyChecking no" to ~jenkins/.ssh/config.

If your jenkins is headless, another convenient way is to ssh git@github.com from another user, and then copy the .ssh/know_hosts file to for example ~jenkins/.ssh/. Also make sure that you change owner of all the files in ~jenkins/.ssh by chown jenkins:jenkins.