无法解析主机名 git: nodename 或 servname 提供,或未知

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20643002/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 09:29:40  来源:igfitidea点击:

Could not resolve hostname git: nodename nor servname provided, or not known

git

提问by Kermit the Frog

I tried doing git pull --rebaseand I am getting the following error:

我尝试这样做git pull --rebase,但出现以下错误:

ssh: Could not resolve hostname git: nodename nor servname provided, or not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I tried doing git remote -vand the origin is properly listed.

我尝试这样做,git remote -v并且正确列出了来源。

How can I fix this error?

我该如何解决这个错误?

回答by Yunus Nedim Mehel

I have recently solved this issue by removing sshfrom the remote address on my fork:

我最近通过ssh从我的叉子上的远程地址中删除来解决这个问题:

origin  ssh://[email protected]:yunus/client.git (fetch)
origin  ssh://[email protected]:yunus/client.git (push)
...

updated as:

更新为:

origin  [email protected]:yunus/client.git (fetch)
origin  [email protected]:yunus/client.git (push)
...

回答by ryan

I had run into the same error. Fix it by switching to another DNS server.

我遇到了同样的错误。通过切换到另一个 DNS 服务器来修复它。

You can try Google DNS

你可以试试谷歌DNS

  • 8.8.8.8
  • 8.8.4.4
  • 8.8.8.8
  • 8.8.4.4

Get answer from here

这里得到答案