DEV Community

Noriko Yamamoto
Noriko Yamamoto

Posted on

What to do when you receive a message from GitHub saying WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

If you pish to GitHub and receive a message like this:

% git push
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
Please contact your system administrator.
Add correct host key in /Users/xxxx/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/xxxx/.ssh/known_hosts:2
Host key for github.com has changed 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.
Enter fullscreen mode Exit fullscreen mode

By using the following command, you can remove all keys belonging to GitHub from the known_hosts file.

$ ssh-keygen -R github.com
Enter fullscreen mode Exit fullscreen mode

After that, you will have a successful push.

Latest comments (0)