ssh:无法解析主机名 github.com:名称解析暂时失败

rae*_*rae 6 linux git github

该存储库一开始是使用 SSH 克隆的。直到今天我推送到 Github 时都没有遇到任何问题。我一整天都在尝试解决这个错误,但我仍然无法解决这个错误..如果有人能阐明这一点,那就太好了!谢谢 :)

\n
2dsnakegame git:(main) git push origin main\nssh: Could not resolve hostname github.com: Temporary failure in name resolution\nfatal: Could not read from remote repository.\n\nPlease make sure you have the correct access rights\nand the repository exists.\n\xe2\x9e\x9c  2dsnakegame git:(main) git remote\norigin\n\xe2\x9e\x9c  2dsnakegame git:(main) git remote --v\norigin  git@github.com:xxxx/2dsnakegame.git (fetch)\norigin  git@github.com:xxxx/2dsnakegame.git (push)\n
Run Code Online (Sandbox Code Playgroud)\n

小智 5

我在 Windows 上使用 WSL2 时遇到了同样的情况。看起来与 DNS 服务器的连接出现了问题,所以我基本上使用以下命令重置了我的 TCP/IP,然后git pull再次git push工作。

来自威斯康星大学:Windows 10 TCP/IP 重置cmd以管理员身份打开 Windows 上的提示符,并按此顺序运行以下命令以解决连接问题:

netsh winsock reset
netsh int ip reset
ipconfig /release
ipconfig /renew
ipconfig /flushdns
Run Code Online (Sandbox Code Playgroud)

最后,重新启动计算机。