git - 无法解析主机名

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38740275/
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 12:09:56  来源:igfitidea点击:

git - Could not resolve hostname

git

提问by Suganthan Madhavan Pillai

I am in a private network using VPN and using Windows platform. I am trying to clone a git project using

我在使用 VPN 和 Windows 平台的专用网络中。我正在尝试使用克隆一个 git 项目

git clone ssh://git@domain-name:somestring/str-somestring.git

But I getting ssh: Could not resolve hostname domain-name: 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.

I having sshgenerated in my local which I added to my local repo as well. Can someone help me out here?

ssh在我的本地生成,我也添加到我的本地存储库中。有人可以帮我吗?

I am sure I all the access for this project.

我确信我拥有这个项目的所有访问权限。

Update

更新

ping google.comis working outside VPN, same is not working inside VPN

ping google.com在 VPN 外工作,同样不在 VPN 内工作

回答by AnoE

The error message is quite clear. gitcannot resolve domain-name.

错误信息非常清楚。git无法解决domain-name

Try, in the same shell you are typing your gitcommands:

尝试在同一个 shell 中输入git命令:

ping domain-name
nslookup domain-name

They won't work either, 99% guaranteed.

他们也不会工作,99% 保证。

If so, the easiest fix is to add that name and its IP address to /etc/hosts(as usual, nothing gitrelated). When ping/ nslookupwork, gitwill as well.

如果是这样,最简单的解决方法是将该名称及其 IP 地址添加到/etc/hosts(像往常一样,没有任何git相关性)。当ping/nslookup工作时,git也会。