One day during my practice, I wanted to push my changes to my online repository on GitHub.
But for absolutely no reason, every time I do, I get this warning:
Warning: Permanently added the ECDSA host key for IP address '140.00.xxx.x' to the list of known hosts.
My known_hosts file is then updated with the new IP with a fingerprint that I do not recognize. The IP address that precedes each fingerprint increments/decrements by one number for each new row that is added to the file, but the fingerprint that I am not recognizing stays the same.
After searching for solutions to my problem, I have found in this GitHub discussion, 2 fixes that can be implemented to resolve this issue.
The first step is to remove the IP address of your remote host.
$ ssh-keygen -R "< IP >"
Next, remove the domain name of your remote host.
$ ssh-keygen -R github.com
Then run this command.
$ curl -L <https://api.github.com/meta> | jq -r '.ssh_keys | .[]' | sed -e 's/^/github.com /' >> ~/.ssh/known_hosts
If you have an issue with jq
not working, you probably need to install it like I did.
This one is a little bit tricky, but many people have said that this command literally saved their lives. So , you can run this command to revolve your issue.
$ for ip in $(for i in $(seq -f "140.82.%g.%%g" 112 127); do seq -f $i 1 254; done); do ssh-keygen -R $ip; done
Hope you slashed that warning, if you want to dive deeper, here are two links you can investigate on:
We updated our RSA SSH host key by GitHub
GitHub's community discussion
I hope you enjoyed reading this, and I'm curious to hear if this tutorial helped you. Please let me know your thoughts below in the comments. Don't forget to subscribe to my newsletter to avoid missing my upcoming blog posts.
You can also find me here LinkedIn • Twitter • GitHub or Medium