git push error after switching from https to ssh
What article on docs.github.com is affected?
ssh error troubleshooting
https://docs.github.com/en/github/authenticating-to-github/troubleshooting-ssh
What part(s) of the article would you like to see updated?
I would like to add and error that comes when i switched from https to ssh and tried to git push to a private repo of mine. After I switched from HTTPS to SSH for my repo then I received this error when pushing to origin master:
ssh: Could not resolve hostname git: Name or service not known
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Additional information
i resolved this error by adding github.com securely to ssh known host file You can mix hashed/unhashed entries in your known_hosts file.
So if you want to add github key, you can just do :
ssh-keyscan github.com >> ~/.ssh/known_hosts
If you want it hashed, add -H
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
Do you need to correct the documentation for the command?
Or am I missing something?
Thanks for opening this issue. A GitHub docs team member should be by to give feedback soon. In the meantime, please check out the contributing guidelines.
👋 Thanks for opening an issue and giving details on what you're seeing! I'll triage this for the team to take a look at and decide whether or not any docs need to be updated ✨
👋 I talked to some folks about what you're seeing, could you give us the steps to reproduce the error? Thanks!
i was having a private repo and i use http method for git push and pull After that i followed steps from github docs to setup SSH on my pc and switched from https to SSH then i tried to push some changes and I got this error then i resolved it by method i have written in addittional info.
Also i got hep from this link https://serverfault.com/questions/856194/securely-add-a-host-e-g-github-to-the-ssh-known-hosts-file
Hello! Thanks for giving us a little more information.
Unfortunately, what we really need are steps to reproduce the problem. I've got a blog post that describes exactly the kind of thing that we'll need to understand the problem you're running into: https://www.lee-dohm.com/2015/01/04/writing-good-bug-reports/
Let me know if you have any questions!
I'm not seeing an update here, so I'm going to close this out. Feel free to add repro steps according to @lee-dohm's blog post!