【问题标题】:How to set git http proxy successfully?如何成功设置 git http 代理?
【发布时间】:2015-12-15 01:44:57
【问题描述】:

我使用以下方式在我的 linux 机器中设置代理。

export HTTP_PROXY=http://proxy.xxxxxx.com
git config --global http.proxy $HTTP_PROXY

但是下面的错误还是发生了。

[root@xxxxxxx cnpm]#  git clone git://github.com/cnpm/cnpmjs.org ./cnpmjs.org
Cloning into './cnpmjs.org'...
fatal: unable to connect to github.com:
github.com[0: 192.30.252.129]: errno=Connection timed out

ps:在我们公司,IE代理使用http://proxy.xxxxxx.com设置,我可以手动下载IE中的git项目。

【问题讨论】:

  • 尝试使用http/https而不是git://,可能是git协议被屏蔽了。

标签: git proxy


【解决方案1】:

http_proxy 只对 http url 有效,对 git url 无效。

git protocol 是与 Git 一起打包的特殊守护进程;它侦听一个专用端口(9418),该端口提供类似于 SSH 协议的服务,但绝对没有身份验证

它与 http_proxy 环境变量无关。

GitHub http url环境设置见:

【讨论】:

  • 谢谢。但我真的使用 git config --global http.proxy $HTTP_PROXY 除了 http_proxy
  • @liamxu 只要您使用的是 git url,这里的 git 配置并不重要。 http 设置将被忽略。
猜你喜欢
  • 2017-06-07
  • 2011-12-05
  • 2022-01-01
  • 1970-01-01
  • 2014-12-31
  • 2012-12-04
  • 1970-01-01
  • 2012-07-28
相关资源
最近更新 更多