LoginSignup
17
6

More than 1 year has passed since last update.

GitHubに接続できなくなった!

Posted at

はじめに

GitHubを使おうとしたらワーニングメッセージが表示されて接続できなくなったので、その時の対応メモを残しておきます。
環境はAWSのEC2でしたが、Macでも同じ現象が起きました。

状況

GitHubでpullしようとしたら次のようなメッセージが表示された。

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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

これまで問題なく使えていたのに突然このような状態になった。

原因

GitHubがセキュリティ対策のために公開鍵情報を変更したため
詳細はこちら

対応

$ ssh git@github.com

# 同じエラーが出ることを確認する

$ ssh-keygen -R github.com

# Host github.com found: line XX といった表示される

$ ssh git@github.com
 
:
:
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])?
# このようなメッセージが表示されるのでyesと入力する

$ ssh git@github.com

# 確認する

PTY allocation request failed on channel 0
Hi xxx! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.

# このように表示されればOK

他のやり方

known_hostsに他のホスト情報が書かれていなければ、known_hosts情報を丸ごと消してしまって良いかもしれません。

$ mv ~/.ssh/known_hosts ~/.ssh/known_hosts.old

$ ssh git@github.com

最後に

GitHubの公開鍵が変更になったことでこのような対応を行いましたが、他のホストでも同様のことが起きる可能性がありますので、参考になればと思います。

最後に対応にあたって情報提供してくれた、M氏、K氏、ご協力ありがとうございました。

17
6
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
17
6