【问题标题】:Unable to Connect to GitHub.com For Cloning无法连接到 GitHub.com 进行克隆
【发布时间】:2013-04-24 07:40:36
【问题描述】:

我正在尝试克隆 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

【问题讨论】:

  • ping github.com 带给你什么?
  • @Laurent 这是我得到的:Pinging github.com [204.232.175.90] with 32 bytes of data:
  • @Laurent Pinging github.com [204.232.175.90] 有 32 个字节的数据:请求超时。请求超时。请求超时。请求超时。 204.232.175.90 的 Ping 统计信息:数据包:发送 = 4,接收 = 0,丢失 = 4(100% 丢失),
  • 你在防火墙后面吗?
  • 试试这个命令:git clone https://github.com/angular/angular-phonecat.git(使用 https)

标签: git github git-bash git-clone


【解决方案1】:

您可能位于防火墙后面。尝试通过 https 进行克隆——这样更有可能不被阻止:

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

【讨论】:

  • 感谢它也帮助了我。我刚刚将 .git > config ==> 中的 url 行更新为 https://git@git...xxx
  • 为我工作,但在从私人组织回购克隆时必须禁用 2 因素身份验证
  • 如果 HTTPS 也超时了怎么办?
  • @STEEL 感谢您为我指明正确的方向。我用不同的选项多次尝试了所有这些insteadOf 命令,并注意到我的~/.git_config 搞砸了。我删除了所有这些,禁用了我的 Mac OSX 防火墙,现在一切正常。
  • 不幸的是,如果依赖项与“angular/angular-phonecat”有依赖项,这将不起作用。
【解决方案2】:

你可以让 git 替你替换协议

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

在 SOBower install using only https? 上查看更多信息

【讨论】:

  • 谢谢伙计。在办公室互联网上工作时,我也遇到了同样的问题。不允许 SSH url。
  • 有没有办法使这项工作仅适用于域 github.com?
  • git config --global url."https://github.com".insteadOf git://github.com
  • 我会将此标记为完美答案,因为那些正在使用 repo/yocto 方式的人
  • 如果您只想临时应用,也可以在~/.gitconfig 中撤消。
【解决方案3】:

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

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

【讨论】:

  • 你能分享一些类似的Windows吗
  • 您的答案与 Chronial 相同,即检查该问题的正确答案。
【解决方案4】:

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

git config --global http.proxy @987654321@
git config --global https.proxy @987654322@

【讨论】:

  • 什么proxy_username??
  • 要使用默认代理凭据,请使用以下命令:git config --global http.proxy http://:@proxy_ip:portgit config --global https.proxy https://:@proxy_ip:port
  • 以下命令也适用于我。 git config --global http.proxy proxy_ip:port git config --global https.proxy proxy_ip:port
【解决方案5】:

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

【讨论】:

  • 如果您已经在使用 https:// 但仍有问题,请尝试此答案。我只需要在我的路由器上添加一个 9418 端口触发器就可以了。
【解决方案6】:

我遇到了这个问题,但我刚刚意识到 GitHub 必须是我的 ISP 的“儿童安全”过滤器默认阻止的站点之一。大概有一些,呃,成人代码库。我将 github.com 添加到我的 ISP 帐户页面的允许列表中,现在一切正常。如果您有类似的过滤器,可能值得检查。

【讨论】:

    猜你喜欢
    • 2013-10-21
    • 2017-05-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多