TL; DR
次のコマンドで対処できると思います。
対処方法コマンド
ssh-keygen -R github.com
# ssh -T git@github.com # 無くてもよさそう(後述)
ssh-keygen -R 20.27.177.113 # github.comのIPアドレス
ssh -T git@github.com
概要
git pull
する際、次のようなWarningメッセージが出るようになりました。
残しておくのも気になるので、消す方法を調べました。
Warningメッセージ
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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 ~/.ssh/known_hosts to get rid of this message.
Offending RSA key in ~/.ssh/known_hosts:1
Password authentication is disabled to avoid man-in-the-middle attacks.
Keyboard-interactive authentication is disabled to avoid man-in-the-middle attacks.
対処方法
他記事にもある通り、GitHub側でhost-keyが変更されたことが原因のようです。
対処方法ですが、おそらく環境位により微妙に異なるかと思うので、上記Warningメッセージが出ている場合での方法を提示します。
対処方法コマンドを、以下に記します。
対処方法コマンド
ssh-keygen -R github.com
ssh -T git@github.com # 無くてもいいかも?(後述)
ssh-keygen -R 20.27.177.113 # github.comのIPアドレス
ssh -T git@github.com
詳細説明
1回目対処時
1回目の ssh-keygen -R github.com
で、次のWarningメッセージに変化しました。
2回目のWarningメッセージ
Warning: Permanently added 'github.com' (ECDSA) to the list of known hosts.
Warning: the ECDSA host key for 'github.com' differs from the key for the IP address '20.27.177.113'
Offending key for IP in ~/.ssh/known_hosts:40
2回目対処時
2回目の ssh -T git@github.com
で、次のWarningメッセージに変化しました。
おそらくですが、2回目と4回目のコマンドに違いはないため、4回目のコマンドだけ実行しても解決できるかもしれません。
3回目のWarningメッセージ
Warning: the ECDSA host key for 'github.com' differs from the key for the IP address '20.27.177.113'
Offending key for IP in ~/.ssh/known_hosts:40
Matching host key in ~/.ssh/known_hosts:55
3回目対処時
3回目の ssh-keygen -R 20.27.177.113
で、次のWarningメッセージに変化しました。
4回目のWarningメッセージ
Warning: Permanently added the ECDSA host key for IP address '20.27.177.113' to the list of known hosts.
4回目対処時
4回目の ssh -T git@github.com
で、全てのWarningメッセージが無くなりました。