当我尝试从git克隆时
git clone "http://github.com/symfony/symfony.git" "d:/www/a/vendor/symfony"
Run Code Online (Sandbox Code Playgroud)
我收到一个错误
Cloning into 'd:/www/a/vendor/symfony'...
error: Couldn't resolve proxy '(null)' while accessing http://github.com/symfony/symfony.git/info/refs
fatal: HTTP request failed
Run Code Online (Sandbox Code Playgroud)
我直接连接到互联网(没有代理).我试图关闭防火墙并没有帮助.我在Windows上,刚从http://code.google.com/p/msysgit/downloads/list安装了Git-1.7.10-preview20120409.exe .以前我有1.7.8,这个命令工作.我也重新安装了TortoiseGit,但我觉得没关系.
我的C:\Documents and Settings\xxx\.gitconfig档案是
[http]
proxy =
[user]
name = xxxx
email = xxx@example.com
Run Code Online (Sandbox Code Playgroud)
小智 109
似乎在邮件列表中报告了该问题.难道这帮助?
git config --global --unset http.proxy
Run Code Online (Sandbox Code Playgroud)
在git bash中运行以下命令
git config --global --unset http.proxy
Run Code Online (Sandbox Code Playgroud)
注意:不要忘记重启git bash,否则它将无法正常工作。
另外,请确保删除HTTPS_PROXY和HTTP_PROXY环境变量。
如果上述步骤对您不起作用,请尝试如下所示设置公司代理:
git config --global http://example.com:8080
git config --global https://example.com:8080
Run Code Online (Sandbox Code Playgroud)
**使用您的公司代理和端口更改example.com/8080
在推开防火墙后,我遇到了同样的问题.
问题不是空的http_proxy var(git var -l没有显示任何代理变量),我的OS环境变量包括:
http_proxy=username:passowrd@proxy.company:port
https_proxy=username:passowrd@proxy.company:port
no_proxy=.company
Run Code Online (Sandbox Code Playgroud)
此设置将始终触发:
error: Couldn't resolve proxy '(null)' while accessing https://...
Run Code Online (Sandbox Code Playgroud)
但是,一旦我更改代理变量,在代理地址前面添加一个' http://',错误消息就会停止:
http_proxy=http://username:passowrd@proxy.company:port
https_proxy=http://username:passowrd@proxy.company:port
no_proxy=.company
Run Code Online (Sandbox Code Playgroud)
(注意' http://'甚至为https代理地址)
当我在公司时和在家时,我有两个工作环境。因此,每一天我都必须设置和取消设置代理变量以使git运行。我发现有效的方法是创建两个bash文件,一个用于设置代理变量,另一个用于“取消设置”。因此,无论何时到达家中或上班,我所要做的就是双击具有管理员权限的文件,然后就完成了。这些文件非常简单:
unset-proxy.bat
setx HTTP_PROXY ""
setx HTTPS_PROXY ""
setx HTTP_PROXY "" /M
setx HTTPS_PROXY "" /M
git config --global --unset http.proxy
git config --global --unset https.proxy
sleep 5
Run Code Online (Sandbox Code Playgroud)
set-proxy.bat
setx HTTP_PROXY <your proxy here>
setx HTTPS_PROXY <your proxy here>
setx HTTP_PROXY <your proxy here> /M
setx HTTPS_PROXY <your proxy here> /M
git config --global <your proxy here>
git config --global <your proxy here>
sleep 5
Run Code Online (Sandbox Code Playgroud)
将sleep 5在年底只保留窗口打开几秒钟,以验证是否所有命令正确运行。