无法连接到GitHub.com进行克隆

时间:2013-04-30 11:39:23

标签: git github git-bash git-clone

我正在尝试克隆angular-phonecat git repository,但是当我在Git Bash中输入命令时,我收到以下消息:

$ git clone git://github.com/angular/angular-phonecat.git  
Cloning into 'angular-phonecat'...  
fatal: unable to connect to github.com:  
github.com[0: 204.232.175.90]: errno=No error

5 个答案:

答案 0 :(得分:299)

你可能在防火墙后面。尝试通过https克隆 - 有更高的机会不被阻止:

git clone https://github.com/angular/angular-phonecat.git

答案 1 :(得分:278)

你可以让git替换你的协议

git config --global url."https://".insteadOf git://

详情请见SO Bower install using only https?

答案 2 :(得分:28)

我遇到了同样的错误,因为我正在使用代理。给出答案,但如果您使用代理,请先使用以下命令设置代理:

git config --global http.proxy http://proxy_username:proxy_password@proxy_ip:port
git config --global https.proxy https://proxy_username:proxy_password@proxy_ip:port

答案 3 :(得分:12)

在防火墙上打开端口9418 - 它是Git用于通信的自定义端口,并且通常不在公司或私有防火墙上打开。

答案 4 :(得分:-4)

您可以尝试使用HTTPS协议进行克隆。终端命令:

git clone https://github.com/RestKit/RestKit.git