7
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

GitHub の RSA SSH host key が更新されました REMOTE HOST IDENTIFICATION HAS CHANGED!

Posted at

はじめに

今しがた GitHub に Push しようとしたら警告が出て失敗したのでメモ

警告内容

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:uNiVztksCsDhcc0u9e8BujQXVUpKZIDTMczCvj3tD2s.
Please contact your system administrator.
Add correct host key in /Users/xxx/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/xxx/.ssh/known_hosts:1
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.

GitHub に接続しようとしたら host key が変わっているので、盗聴の恐れがある、とのことです

そのままこれを受け入れていいか、本当に盗聴されている可能性があるのか判断できないので、 GitHub のブログを確認すると、以下の記事がありました

というわけで、確かに GitHub の方で host key を変更していました

盗聴されそうになったわけではないようです

対処法

公式に従って以下のコマンドを実行します

まず ~/.ssh/known_hosts から古い host key を削除します

ssh-keygen -R github.com

GitHub 公式から新しい host key を取得して ~/.ssh/known_hosts に追加します

curl -L https://api.github.com/meta | jq -r '.ssh_keys | .[]' | sed -e 's/^/github.com /' >> ~/.ssh/known_hosts

この状態で git push すると警告メッセージなくプッシュできました

まとめ

一瞬ドキッとしますが、調べればすぐ対処できる内容でした

7
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?