Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github remote host problem and solution #411

Open
funderburkjim opened this issue Apr 2, 2023 · 2 comments
Open

Github remote host problem and solution #411

funderburkjim opened this issue Apr 2, 2023 · 2 comments

Comments

@funderburkjim
Copy link
Contributor

Anyone pushing a repository (@drdhaval2785 @Andhrabharati @AnnaRybakovaT @funderburkjim or others)
may encounter an alarming message.

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 /c/Users/jimfu/.ssh/known_hosts to get rid of this message.
Offending RSA key in /c/Users/jimfu/.ssh/known_hosts:1
RSA 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.

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

Never fear! This is not too hard to remedy.

Below is one way to do it.

@funderburkjim
Copy link
Contributor Author

funderburkjim commented Apr 2, 2023

copy paste solution

Find your 'known_hosts' file.
In my case it is in directory c:/Users/jimfu/.ssh/

  • Using file explorer, change to the .ssh directory.
  • cp known_hosts known_hosts_old # save a copy, just in case
  • edit known_hosts with your text editor --- it is just a text file.
    • The file is 'ugly' as it has long 'host keys'
  • Delete the line that has 'github.com' in it.
    • There may be other lines that have various ip addresses used by Github.com. Delete these also
    • There may be lines unrelated to Github. Do not delete these.
    • You can find the 'owner' of an ip address by a search. e.g. ip 140.82.112.4 shows Github as owner
    • Copy the new RSA host key as given in the github.blog link above. It starts as
    • github.com ssh-rsa AAAA
  • Paste that new line into known_hosts
  • Save known_hosts.

Now you are ready to push. You will probably see a warning from the push that looks like:

git push
Warning: Permanently added the RSA host key for IP address '140.82.114.4' to the list of known hosts.
(And then the normal output from git push will appear).

Hope this info works for you!

@Andhrabharati
Copy link

I just tried pushing a test file & no issues encountered.

[I seem to be not using the -ssh option.]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants