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

Moh*_*ain 166 git github git-clone git-bash

我正在尝试克隆angular-phonecat git存储库,但是当我在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
Run Code Online (Sandbox Code Playgroud)

Chr*_*ial 307

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

git clone https://github.com/angular/angular-phonecat.git
Run Code Online (Sandbox Code Playgroud)

  • 谢谢它也帮助了我.我刚刚将.git> config ==>中的url行更新为https://git@git...xxx (4认同)
  • 如果HTTPS也超时,该怎么办? (4认同)

bng*_*n82 281

你可以让git替换你的协议

git config --global url."https://".insteadOf git://
Run Code Online (Sandbox Code Playgroud)

只使用https在SO Bower安装中查看更多信息

  • git config --global url。“ https://github.com” .insteadOf git:// github.com` (4认同)
  • 如果您只想暂时应用它,也可以在 `~/.gitconfig` 中撤消此操作。 (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


Chr*_*row 14

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

  • 如果您已经在使用 https:// 并且仍有问题,请尝试此答案。我只需要在我的路由器上添加一个 9418 端口触发器就可以了。 (2认同)