Remove SSH keys from known host file by IP address
Github had a situation which caused the need to potentially remove Github's keys from your known_hosts
file.
This can be done easily with the SSH command:
ssh-keygen -R github.com
This is great... except when it isn't. I specifically ran into an issue where my connection was trying to utilize specific github IP addresses. Have no fear... it turns out that the same command can be utilized.
ssh-keygen -R 140.82.114.4
I actually had to do a few of them
ssh-keygen -R 140.82.113.3
etc...
You could potentially use github's meta information endpoint to find address ranges, but that's a problem for a more clever person.
Tweet