git 无法解析主机:bitbucket.org;提供了节点名或服务名,或未知
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18928722/
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
Could not resolve host: bitbucket.org; nodename nor servname provided, or not known
提问by Annie
This error comes up every time I try clone any repo from Bitbucket using terminal:
每次我尝试使用终端从 Bitbucket 克隆任何 repo 时都会出现此错误:
$ git clone https://[email protected]/me/myrepo.git
Cloning into 'blog'...
fatal: unable to access 'https://[email protected]/me/myrepo.git': Could not
resolve host: bitbucket.org; nodename nor servname provided, or not known
I had the same problem with GitHub resolved by replacing 'http' with 'git' protocol which was great! But when I tried that on Bitbucket I got this:
我通过用 'git' 协议替换 'http' 解决了与 GitHub 相同的问题,这很棒!但是当我在 Bitbucket 上尝试时,我得到了这个:
git clone git://[email protected]/me/myrepo.git
Cloning into 'blog'...
fatal: Unable to look up [email protected] (port 9418) (nodename nor servname
provided, or not known)
So I removed 'me@', making it the same as the actual webpage, and the operation just times out. Help?
所以我把'me@'去掉了,让它和实际的网页一样,操作就超时了。帮助?
回答by Paul Bissex
In your ~/.gitconfig
, is there an [http]
section with a proxy
entry in it? If so, that may be the source of your trouble. (I extracted this idea from a help page link posted above.)
在您的 中~/.gitconfig
,是否有包含条目的[http]
部分proxy
?如果是这样,那可能是您麻烦的根源。(我从上面发布的帮助页面链接中提取了这个想法。)
回答by Avishai
When cloning from Bitbucket via a terminal on mac osx, only http is supported, not https.
通过 mac osx 上的终端从 Bitbucket 克隆时,仅支持 http,不支持 https。
You should be able to use the exact same command just using http.
您应该能够使用完全相同的命令,只需使用 http。
The Bitbucket repository overview webpage gives a clone command that includes https. On Mac, just remove the 's'.
Bitbucket 存储库概述网页提供了一个包含 https 的克隆命令。在 Mac 上,只需删除“s”。