git clone 是否通过 NTLM 代理工作? [英] Does git clone work through NTLM proxies?

查看:25
本文介绍了git clone 是否通过 NTLM 代理工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试使用 export http_proxy=http://[username]:[pwd]@[proxy]git config --global http.proxy http://[用户名]:[密码]@[代理].

我无法让它工作.看起来 git 使用基本身份验证:

在/home/.../.git/中初始化空的 Git 存储库* 无法在 .netrc 文件中找到主机 github.com,使用默认值* 即将 connect() 到 github.com 端口 8080 (#0)* 尝试 10.... * 连接到 github.com (10....) 端口 8080 (#0)* 使用 Basic 和用户..."进行代理身份验证>获取 http://github.com/sunlightlabs/fiftystates.git/info/refs HTTP/1.1代理授权:基本MD...用户代理:git/1.6.1.2主办方:github.com编译指示:无缓存接受: */*代理连接:保持活动<HTTP/1.1 407 需要代理身份验证(ISA 服务器需要授权才能完成请求.访问 tWeb 代理过滤器被拒绝.)<通过:1.1 ...<代理验证:协商<代理验证:Kerberos<代理验证:NTLM<连接:保持活动<代理连接:保持活动<编译指示:无缓存<缓存控制:无缓存<内容类型:文本/html<内容长度:4118* 请求的 URL 返回错误:407* 关闭连接#0致命:http://github.com/sunlightlabs/fiftystates.git/info/refs 下载错误 - 请求的 URL 返回错误:407

Google 搜索返回的结果混合且可能未更新.它在某处说 curl 是(曾经?)在引擎盖下使用的,但它的选项(是?)硬连线到代码中.例如,

curl --proxy-ntlm --proxy ...:8080 google.com

有效,我想对 git 使用相同的选项.

我需要一些更明确的答案:有没有人通过 Windows 代理成功使用 git?哪个版本?

谢谢.

解决方案

Git 从 1.7.10 版本开始支持 NTLM 代理身份验证,相关 commit 为 https://github.com/gitster/git/commit/dd6139971a18e25a5089c0f96dc80e4546>p

1.7.10 发行说明 简单地提到它:

* HTTP 传输学会了在需要时使用代理进行身份验证.

我已经在我的工作场所使用 NTLM 代理成功测试了它并且需要用户/密码,您可以使用以下命令进行测试:

git config --global http.proxy http://user:password@proxy.com:portgit 克隆 http://git.videolan.org/git/bitstream.git

问候,

I've tried both using export http_proxy=http://[username]:[pwd]@[proxy] and git config --global http.proxy http://[username]:[pwd]@[proxy].

I couldn't make it work. It looks like git uses Basic authentication:

Initialized empty Git repository in /home/.../.git/
* Couldn't find host github.com in the .netrc file, using defaults
* About to connect() to github.com port 8080 (#0)
*   Trying 10.... * Connected to github.com (10....) port 8080 (#0)
* Proxy auth using Basic with user '...'
> GET http://github.com/sunlightlabs/fiftystates.git/info/refs HTTP/1.1
Proxy-Authorization: Basic MD...
User-Agent: git/1.6.1.2
Host: github.com
Pragma: no-cache
Accept: */*
Proxy-Connection: Keep-Alive

< HTTP/1.1 407 Proxy Authentication Required ( The ISA Server requires authorization to fulfill the request. Access to t
he Web Proxy filter is denied.  )
< Via: 1.1 ...
< Proxy-Authenticate: Negotiate
< Proxy-Authenticate: Kerberos
< Proxy-Authenticate: NTLM
< Connection: Keep-Alive
< Proxy-Connection: Keep-Alive
< Pragma: no-cache
< Cache-Control: no-cache
< Content-Type: text/html
< Content-Length: 4118
* The requested URL returned error: 407
* Closing connection #0
fatal: http://github.com/sunlightlabs/fiftystates.git/info/refs download error - The requested URL returned error: 407

Google search returned mixed and probably not updated results. Somewhere it says that curl is (was?) used under the hood, but its options are (were?) hardwired into code. For example,

curl --proxy-ntlm --proxy ...:8080 google.com

works, and I'd like to use the same option with git.

I need some more definite answers here: has anybody succeed using git through Windows proxies? Which version?

Thanks.

解决方案

Git supports NTLM proxy authentication from version 1.7.10 onwards, relevant commit is https://github.com/gitster/git/commit/dd6139971a18e25a5089c0f96dc80e454683ef0b

1.7.10 release notes briefly mentioned it as:

* HTTP transport learned to authenticate with a proxy if needed.

I've successfully tested it with the proxy at my workplace which is NTLM and requires user/pass, you can test yourself with following commands:

git config --global http.proxy http://user:password@proxy.com:port
git clone http://git.videolan.org/git/bitstream.git

Regards,

这篇关于git clone 是否通过 NTLM 代理工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆