Githubにpushできなくなったので対応した WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

cloud storage storage medium 7832676

Intellij IDEAでGithubにPushしようとしたところ、次のエラーが出てPushに失敗しました。

22:39:54.813: [xxx] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false push --progress --porcelain origin refs/heads/main:main
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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/user/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/user/.ssh/known_hosts:5
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に接続できなくなった! – Qiita
https://qiita.com/tatsumi_t2/items/cb50b73e252c13e91970

user: .ssh/ % ssh git@github.com
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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:xxxxxx
Please contact your system administrator.
Add correct host key in /Users/user/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/user/.ssh/known_hosts:5
Host key for github.com has changed and you have requested strict checking.
Host key verification failed.
user: .ssh/ % ssh-keygen -R github.com
# Host github.com found: line 5
/Users/user/.ssh/known_hosts updated.
Original contents retained as /Users/user/.ssh/known_hosts.old
user: .ssh/ % ssh git@github.com
The authenticity of host 'github.com (20.27.177.113)' can't be established.
ED25519 key fingerprint is SHA256:xxxxxx
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
PTY allocation request failed on channel 0
Hi user! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.
user: .ssh/ % ssh git@github.com
PTY allocation request failed on channel 0
Hi user! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.
user: .ssh/ %

その後Intellij IDEAでも問題なくPush出来ました。

remote: Resolving deltas:   0% (0/21)        
remote: Resolving deltas:   4% (1/21)        
remote: Resolving deltas:   9% (2/21)        
remote: Resolving deltas:  14% (3/21)        
remote: Resolving deltas:  19% (4/21)        
remote: Resolving deltas:  23% (5/21)        
remote: Resolving deltas:  28% (6/21)        
remote: Resolving deltas:  33% (7/21)        
remote: Resolving deltas:  38% (8/21)        
remote: Resolving deltas:  42% (9/21)        
remote: Resolving deltas:  47% (10/21)        
remote: Resolving deltas:  52% (11/21)        
remote: Resolving deltas:  57% (12/21)        
remote: Resolving deltas:  61% (13/21)        
remote: Resolving deltas:  66% (14/21)        
remote: Resolving deltas:  71% (15/21)        
remote: Resolving deltas:  76% (16/21)        
remote: Resolving deltas:  80% (17/21)        
remote: Resolving deltas:  85% (18/21)        
remote: Resolving deltas:  90% (19/21)        
remote: Resolving deltas:  95% (20/21)        
remote: Resolving deltas: 100% (21/21)        
remote: Resolving deltas: 100% (21/21), completed with 15 local objects.        
To github.com:user/xxxxxx.git
 	refs/heads/main:refs/heads/main	d627040..97cff65
Done

		
よかったらシェアしてね!
目次