🐙

GitHubにSSH接続すると WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! になる

2023/03/26に公開

直し方

以下のコマンドを実行します。

ssh-keygen -R github.com

その後、git pullを実行すると

Are you sure you want to continue connecting (yes/no/[fingerprint])?

と聞いてきますので、yesとタイプします。直ります。

なぜ発生したのか?

GitHubがセキュリティ対策でSSHホストキーを変更したため。

こちらがGitHubの公式ブログでの説明になります。

https://github.blog/2023-03-23-we-updated-our-rsa-ssh-host-key/

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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:uNiVztksCsDhcc0u9e8BujQXVUpKZIDTMczCvj3tD2s.
Please contact your system administrator.
Add correct host key in ~/.ssh/known_hosts to get rid of this message.
Host key for github.com has changed and you have requested strict checking.
Host key verification failed.

ChatGPTの要約

GitHub.com replaced its RSA SSH host key used to secure Git operations as a precautionary measure after discovering that the key was briefly exposed in a public GitHub repository. The key replacement only affects Git operations over SSH using RSA, while web traffic to GitHub.com and HTTPS Git operations are not affected. GitHub.com’s ECDSA or Ed25519 keys remain unchanged. The company has documented its new RSA SSH public key entry, and users who need to remove the old key can do so by following the instructions provided in the post. GitHub Actions users may encounter failed workflow runs if they use the ssh-key option, and the company is updating the actions/checkout action to address this issue.

GitHub.comは、公開GitHubリポジトリで一時的にRSA SSHホストキーが公開されたことを発見した後、予防措置としてGit操作のために使用されるRSA SSHホストキーを置き換えました。キーの置換は、RSAを使用したGit操作のみに影響し、WebトラフィックとHTTPS Git操作には影響を与えません。GitHub.comのECDSAまたはEd25519キーは変更されていません。同社は新しいRSA SSH公開キーエントリを文書化しており、古いキーを削除する必要があるユーザーは、投稿で提供された手順に従って行うことができます。 GitHub Actionsユーザーは、ssh-keyオプションを使用する場合にワークフローが失敗する可能性があり、同社はactions/checkoutアクションを更新してこの問題に対処しています。

Discussion