And*_*eaG 18 git proxy curl ntlm
我试过用export http_proxy=http://[username]:[pwd]@[proxy]和git config --global http.proxy http://[username]:[pwd]@[proxy].
我无法让它发挥作用.看起来git使用Basic身份验证:
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
Run Code Online (Sandbox Code Playgroud)
Google搜索返回了混合且可能未更新的结果.在某个地方,它说curl(是?)在引擎盖下使用,但它的选项(是?)硬连线到代码中.例如,
curl --proxy-ntlm --proxy ...:8080 google.com
Run Code Online (Sandbox Code Playgroud)
工作,我想与git使用相同的选项.
我在这里需要一些更明确的答案:有没有人通过Windows代理成功使用git?哪个版本?
谢谢.
rof*_*rol 22
要使用默认的NTLM凭据,请提供空的用户名和密码
git config --global http.proxy https://:@proxy:port
Run Code Online (Sandbox Code Playgroud)
您可以使用Microsoft的ISA Server防火墙客户端,而不是为git,npm等设置代理.安装后:
Start > Autostart > Microsoft Firewall Client Management
Settings tab > Manual specified ISA Server > proxy:port
Web Browser tab > Uncheck "Enable web browser automatic configuration."
Nel*_*son 19
Git支持从版本1.7.10开始的NTLM代理身份验证,相关提交是https://github.com/gitster/git/commit/dd6139971a18e25a5089c0f96dc80e454683ef0b
1.7.10 发布说明简要提到它:
* HTTP transport learned to authenticate with a proxy if needed.
Run Code Online (Sandbox Code Playgroud)
我已经成功地在我的工作场所使用代理进行了测试,这是NTLM并且需要用户/通行证,您可以使用以下命令测试自己:
git config --global http.proxy http://user:password@proxy.com:port
git clone http://git.videolan.org/git/bitstream.git
Run Code Online (Sandbox Code Playgroud)
问候,
lem*_*nad 10
克隆对我有用,但只能通过HTTP(因为我们的公司防火墙阻止了ssh/git协议):
$ export http_proxy="http://username:password@proxy:port/"
$ git clone http://github.com/sunlightlabs/fiftystates_site.git fifty
Initialized empty Git repository in /home/user/fifty/.git/
got e15f5192b923d8e87abaeb9406d0f4d80403da09
walk e15f5192b923d8e87abaeb9406d0f4d80403da09
got a78b792191f1cf5e961753dcfe05e9c809bdb0ed
got 76e6e86e72a0f998f7663da69ca49c457a302e27
walk 76e6e86e72a0f998f7663da69ca49c457a302e27
got 35b68a3b876fb90e73ba7a7eb51432e825ef2aa3
...
Run Code Online (Sandbox Code Playgroud)
Github建议克隆,git://github.com/...但你必须http://github.com/...手动更改它.
编辑:我正在使用git版本1.5.6.3.
希望有所帮助!
Ste*_*ght 10
AndreaG(在上面的评论中)对我能找到的这个问题有唯一可接受的答案.似乎Git只是不能使用NTLM代理,即使它真的应该因为cURL(它在下面使用)确实工作得很好.为什么这个问题无法修复我不知道.这似乎是一个相当普遍的问题.
完整的解决方案是使用ntlmaps充当代理的代理.您需要做的就是从以下网址下载最新版本的应用程序:http: //ntlmaps.sourceforge.net/
更改配置文件以包含您的身份验证和代理详细信息,然后将代理设置为新的本地代理:
git config --global http.proxy http://localhost:5865
Run Code Online (Sandbox Code Playgroud)
我可以确认它工作得很好.您不仅可以将它用于任何需要NTLM身份验证但不提供完整NTLM支持的应用程序.
你也可以使用cntlm,
类似于ntlmaps但使用纯C编写的解决方案.它通过在计算机上的端口(默认为3128)创建本地代理服务器(127.0.0.1),以与ntlmaps相同的方式工作.这个新的本地创建的代理服务器不需要任何身份验证,因此可以与任何支持http代理的应用程序一起使用.如果需要,它还可以创建本地socks代理.
使用python编写的ntlmaps的主要优点是cntlm具有非常低的CPU和RAM使用率,通常<2%.
小智 5
TL/DR:
export GIT_HTTP_PROXY_AUTHMETHOD=basic
Run Code Online (Sandbox Code Playgroud)
或者
git config --global http.proxyauthmethod basic
Run Code Online (Sandbox Code Playgroud)
当 git (curl) 代理身份验证不起作用时,我遇到了同样的问题。凭证是正确的。升级到最新的 git-v2.15.0 没有帮助。
该问题是由于 git-libcurl 选择了错误的代理身份验证方法造成的。
有效的 proxy_authmethod 选项在 git 源代码中定义: https://github.com/git/git/blob/d0e9983980a25e0c398cc03342e5ad22ef85b8a8/http.c#L81
GIT_HTTP_PROXY_AUTHMETHODproxyauth 方法可以通过环境变量或http.proxyauthmethodgit config 选项定义。环境变量覆盖配置选项值。
| 归档时间: |
|
| 查看次数: |
24525 次 |
| 最近记录: |