在Windows 7上使用Git Bash,经过代理后无法正常工作

4

我正在使用一个32位的Windows 7电脑,并且在代理后面工作。我刚刚将我的Git客户端(Git Bash)升级到Git-1.8.3-preview20130601,但突然间,每当我尝试推送/拉取时,就会出现以下错误:

fatal: unable to access 'https://github.com/User/simple_timesheets.git/: 
Received HTTP code 407 from proxy after Connect

我在升级之前可以轻松做到这一点,甚至当我尝试恢复到我认为我拥有的最后一个版本时,我仍然会收到错误提示。运行git config -l命令时,它列出了以下变量(以及其他变量):

user.name=MyName
user.email=My@email.com
http.proxy=http://user:password@server:port
core.autocrlf=true
https.proxy=http://user:password@server:port
http.sslcainfo=/bin/curl-ca-bundle.crt

奇怪的是,我似乎可以使用Git Bash客户端轻松使用curl命令。

curl finance.yahoo.com --proxy http://user:password@server:port

甚至可以访问我在计算机上搭建的伪造https网站:

curl https://localhost:3000 --insecure

有什么想法我错过了什么吗?谢谢
编辑:
我可能错了,但我认为版本1.8.3中的curl可能存在问题。我卸载了电脑上我能想到的所有与git相关的应用程序,并安装了Git-1.8.0-preview20121022,对一个repo进行了拉取,并成功了。
为了好玩,我卸载了可用版本,保留了证书文件;然后重新安装了1.8.3版本,看看这是否与此无关,但我得到了最初尝试解决的相同错误。
此外,在重新安装1.8.0版本后,我尝试使用以下命令在https网站(gmail)上进行curl:curl https://www.gmail.com --proxy http://user:pass@server:port,成功了。当我在1.8.3下执行此操作时,我收到了关于代码407的错误。版本切换似乎解决了这个问题。

我刚刚尝试运行以下命令:curl https://www.gmail.com --proxy http://user:password@server:port > gmail.html,但是它返回了以下内容:curl: (56) Received HTTP code 407 from proxy after CONNECT - JWally
重复的问题,参见我的那里的回答,关于https代理。 - thinkOfaNumber
2个回答

1
我遇到了同样的问题,通过使用两个代理过滤器解决了它:

"--proxy或-x"和"--proxy-user"。

curl -x http://proxyserverurl:port --proxy-user username:password -L http://url

尽管您尝试的方法也没有错,但可能与您的curl版本不兼容。

希望这可以帮到您!


0

我曾经遇到过同样的问题。导出环境变量https_proxyhttp_proxy解决了这个问题。所以我最终在主目录下的.bashrc文件中添加了以下行:

# Configure proxy settings
export https_proxy='http://myproxy.example.com:8086/' 
export http_proxy='http://myproxy.example.com:8086/' 

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接