注意:虽然所描述的用例是关于在项目中使用子模块,但同样适用于通过HTTP的存储库的普通git克隆。
我有一个Git控制下的项目。我想增加一个子模块:
git submodule add http://github.com/jscruggs/metric_fu.git vendor/plugins/metric_fu
但是我知道
...
got 1b0313f016d98e556396c91d08127c59722762d0
got 4c42d44a9221209293e5f3eb7e662a1571b09421
got b0d6414e3ca5c2fb4b95b7712c7edbf7d2becac7
error: Unable to find abc07fcf79aebed56497e3894c6c3c06046f913a under http://github.com/jscruggs/metri...
Cannot obtain needed commit abc07fcf79aebed56497e3894c6c3c06046f913a
while processing commit ee576543b3a0820cc966cc10cc41e6ffb3415658.
fatal: Fetch failed.
Clone of 'http://github.com/jscruggs/metric_fu.git' into submodule path 'vendor/plugins/metric_fu'
我有我的HTTP_PROXY设置:
c:\project> echo %HTTP_PROXY%
http://proxy.mycompany:80
我甚至有一个http代理的全局Git设置:
c:\project> git config --get http.proxy
http://proxy.mycompany:80
有人获得HTTP获取始终通过代理工作吗?真正奇怪的是,GitHub上的一些项目工作得很好(例如awesome_nested_set),但其他项目总是失败(例如rails)。
我也遇到了同样的问题,但修复方法略有不同:使用HTTP支持重新构建GIT
git:协议无法通过我的公司防火墙。
例如,这个超时了:
git clone git://github.com/miksago/node-websocket-server.git
curl github.com工作得很好,所以我知道我的http_proxy环境变量是正确的。
我尝试使用http,如下所示,但立即得到一个错误。
git clone http://github.com/miksago/node-websocket-server.git
->>> fatal: Unable to find remote helper for 'http' <<<-
我试着像这样重新编译git:
./configure --with-curl --with-expat
但还是犯了致命的错误。
最后,经过几个令人沮丧的小时,我阅读了配置文件,
看到了这个:
#定义CURLDIR=/foo/bar如果你的curl头文件和库文件在
# /foo/bar/include和/foo/bar/lib目录
然后我想起来了,我没有从源头上遵从curl,所以就去了
查找头文件。果然没有安装。这就是问题所在。Make没有抱怨丢失头文件。所以
我没有意识到——with-curl选项什么都没有做(事实上,在我的git版本中它是默认的)。
我做了以下来修复它:
Added the headers needed for make:
yum install curl-devel
(expat-devel-1.95.8-8.3.el5_5.3.i386 was already installed).
Removed git from /usr/local (as I want the new install to live there).
I simply removed git* from /usr/local/share and /usr/local/libexec
Searched for the include dirs containing the curl and expat header files, and then (because I had read through configure) added these to the environment like so:
export CURLDIR=/usr/include
export EXPATDIR=/usr/include
Ran configure with the following options, which, again, were described in the configure file itself, and were also the defaults but what the heck:
./configure --with-curl --with-expat
And now http works with git through my corporate firewall:
git clone http://github.com/miksago/node-websocket-server.git
Cloning into 'node-websocket-server'...
* Couldn't find host github.com in the .netrc file, using defaults
* About to connect() to proxy proxy.entp.attws.com port 8080
* Trying 135.214.40.30... * connected
...