Problem
잘 사용 중이던 github가 어느날 git push
시 WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
오류가 발생하였다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$ 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:uNiVztksCsDhcc0u9e8................
Please contact your system administrator.
Add correct host key in /Users/niceharu/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/niceharu/.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.
Cause
SSH 접속 시 원격지의 식별정보가 바뀐 경우 나타나는 현상이다. 주로 목적지(github)의 IP는 동일한데, 목적지의 서버 장비나 환경이 바뀐 경우 나타난다.
Solution
계정 아래 .ssh/known_hosts
파일에 접속했던 사이트들의 ssh-rsa
키 값들이 저장되어 있는데 아래 명령어를 통해 해당 파일을 갱신해 준다.
1
$ ssh-keygen -R github.com