docs icon indicating copy to clipboard operation
docs copied to clipboard

git push error after switching from https to ssh

Open NEEHITGOYAL opened this issue 5 years ago • 7 comments

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?

NEEHITGOYAL avatar Jan 24 '21 06:01 NEEHITGOYAL

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.

welcome[bot] avatar Jan 24 '21 06:01 welcome[bot]

👋 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 ✨

janiceilene avatar Jan 25 '21 18:01 janiceilene

👋 I talked to some folks about what you're seeing, could you give us the steps to reproduce the error? Thanks!

janiceilene avatar Feb 23 '21 15:02 janiceilene

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.

NEEHITGOYAL avatar Feb 24 '21 09:02 NEEHITGOYAL

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

NEEHITGOYAL avatar Feb 24 '21 09:02 NEEHITGOYAL

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!

lee-dohm avatar Feb 24 '21 22:02 lee-dohm

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!

janiceilene avatar Mar 03 '21 18:03 janiceilene