ssh: Could not resolve hostname github.com: Temporary failure in name resolution

Viewed 5420

The repo was cloned using SSH at the start. I had no issues pushing to Github until today. I've been trying to solve this error for a whole day but i still cannot solve this error.. It would be great if anyone can shed some light on this! Thank you :)

2dsnakegame git:(main) git push origin main
ssh: Could not resolve hostname github.com: Temporary failure in name resolution
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
āžœ  2dsnakegame git:(main) git remote
origin
āžœ  2dsnakegame git:(main) git remote --v
origin  git@github.com:xxxx/2dsnakegame.git (fetch)
origin  git@github.com:xxxx/2dsnakegame.git (push)
1 Answers

I had the same situation working on Windows with WSL2. It looks like there was a trouble on the connection to the DNS server, so I basically reset my TCP/IP with the following commands and then git pull/git push worked again.

From University of Wisconsin: Windows 10 TCP/IP Reset: Open the cmd prompt on Windows as an administrator and run the following commands in this order in order to fix your connection problem:

netsh winsock reset
netsh int ip reset
ipconfig /release
ipconfig /renew
ipconfig /flushdns

Finally, restart your computer.

Related