If GitHub's recent RSA SSH host key update causes your system to throw this error:
Warning: the ECDSA host key for 'github.com' differs from the key for the IP address '140.82.113.3'
The solution is a quick fix. The next lines of the error will read something like this:
Offending key for IP in ~/.ssh/known_hosts:X
Matching host key in ~/.ssh/known_hosts:Y
Are you sure you want to continue connecting (yes/no)?
Where X
is the line number containing the IP address we want to remove. So...
Run the following command:
vi ~/.ssh/known_hosts
And ⬇️ to line X
and run the following to delete the line and exit vi:
dd
:x
Voila!
Top comments (3)
You can also do
sed -e "Xd" ~/.ssh/known_hosts
to delete lineX
(the line number from above). A little bit easier than using Vim. 😅Would you need the in-place argument?
sed -i "Xd" ~/.ssh/known_hosts
?While this does the trick, it bypasses the tools that are offered by the ssh package.
The ssh package has a tool called
ssh-keygen
with a 'remove' subcommand-R
.So you should be using
ssh-keygen -R 140.82.113.3
.