无法解析主机名 git:提供节点名或服务名,或未知

  • 本文关键字:节点 服务 未知 主机 git git
  • 更新时间 :
  • 英文 :


我尝试执行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.

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

如何修复此错误?

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

origin  ssh://git@ghe.company.net:yunus/client.git (fetch)
origin  ssh://git@ghe.company.net:yunus/client.git (push)
...

更新为:

origin  git@ghe.company.net:yunus/client.git (fetch)
origin  git@ghe.company.net:yunus/client.git (push)
...

只需将主机名添加到/etc/hosts文件

# IP       hostname
1.55.4.5.66 hostname@host.com

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

你可以试试谷歌域名

  • 8.8.8.8
  • 8.8.4.4

从这里获得答案

最新更新