Git通过HTTPS可以做ls列表,但不能克隆通过HTTP代理

Git通过HTTPS可以做ls列表,但不能克隆通过HTTP代理

问题描述:

这是一个常见的问题/问题,但我与其他人有不同的问题。我试图通过我的http代理在工作中使用git。我已经在git中配置了我的代理设置:

This is a common question/problem, however I am having slightly different problems than others. I am trying to use git via my http proxy at work. I have already configured my proxy settings in git:

C:\Program Files (x86)\Git\bin>git config --global -l
http.proxy=https://c172635b4:password@p01.proxy.local:8080

当我发布git ls-remote https:// eric @ git .assembla.com / myproj.git ,它会询问我的密码并提供预期的结果。这确认git是通过代理正确认证。

When I issue git ls-remote https://eric@git.assembla.com/myproj.git, it asks me for the password and provides the expected result. This confirms that git is authenticating via the proxy properly.

但是,当我尝试做一个git克隆,我得到以下错误。

However, when I try to do a git clone, I get the following error.

error: RPC failed; result=22, HTTP code = 0
fatal: The remote end hung up unexpectedly

I使用GIT_CURL_VERBOSE = 1运行它以查看日志,并且我能够看到它正确认证到NTLM代理,直到结束:

I've run it with GIT_CURL_VERBOSE=1 to see the log and I am able to see it authenticating to the NTLM proxy properly until the end:

< HTTP/1.1 407 Proxy Authentication Required
< Proxy-Authenticate: NTLM TlRMTVNTUAACAAAABgAGADgAAAA1goniA432smdf3mwAAAAAAAAAALAAsAA+AAAABgByFwAAAA9SAEUAUwACAAYAUgBFAFMAAQAYAFcAUwBQAEkAQwBCAEMAQQBBAEEAMAAxAAQAHAByAGUAcwAuAGIAbgBnAGYALgBsAG8AYwBhAGwAAwA2AFcAUwBQAEkAQwBCAEMAQQBBAEEAMAAxAC4AcgBlAHMALgBiAG4AZwBmAC4AbABvAGMAYQBsAAUAHAByAGUAcwAuAGIAbgBnAGYALgBsAG8AYwBhAGwABwAIAGq6JY+ND84BAAAAAA==
< Cache-Control: no-cache
< Pragma: no-cache
< Content-Type: text/html; charset=utf-8
< Proxy-Connection: Keep-Alive
< Set-Cookie: BCSI-CS-dcfa3879f83cfd49=2; Path=/
< Connection: Keep-Alive
< Content-Length: 3742
< 
* Ignore 3742 bytes of response-body
* NTLM send, close instead of sending 2531 bytes
* Received HTTP code 407 from proxy after CONNECT
* About to connect() to proxy p01.proxy.local port 8080 (#0)
*   Trying 172.31.132.18... * connected
* Connected to p01.proxy.local (172.31.132.18) port 8080 (#0)
* Establish HTTP proxy tunnel to git.assembla.com:443
* Proxy auth using NTLM with user 'c172635b4'
* Server auth using Basic with user 'eric'
> CONNECT git.assembla.com:443 HTTP/1.1
Host: git.assembla.com:443
Proxy-Authorization: NTLM TlRMTVNTUAADAAAAGAAYAIIAAAAYABgAmgAAAAYABgBYAAAAEAAQAF4AAAAUABQAbgAAABAAEACyAAAANYKI4gYBsR0AAAAPN9Y0OSiIbF7a4dr8yIqv9WwAYgBnAGMANgAxADIANwAxAGIANAAyAFUAQQAxADMAOAAxAEQAUwA1ADKgzMJlkKLlAAAAAAAAAAAAAAAAAAAAAHVtirzD6urrzJLWZ73HGWxFUEd926He985LMc+KepdWBDDgQQBESv8=
User-Agent: git/1.7.10.5997.gaa4aa
Proxy-Connection: Keep-Alive
Content-Type: application/x-git-upload-pack-request
Accept: application/x-git-upload-pack-result
Content-Encoding: gzip

< HTTP/1.1 407 Proxy Authentication Required
< Proxy-Authenticate: NTLM
* Authentication problem. Ignoring this.
< Cache-Control: no-cache
< Pragma: no-cache
< Content-Type: text/html; charset=utf-8
< Proxy-Connection: close
< Set-Cookie: BCSI-CS-dcfa3879f83cfd49=2; Path=/
< Connection: close
< Content-Length: 3742
< 
* Closing connection #0
* HTTP response code said error

运行:

git version 1.7.10.msysgit.1

curl 7.21.1 (i686-pc-mingw32) libcurl/7.21.1 OpenSSL/0.9.8r zlib/1.2.3
Protocols: dict file ftp ftps http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp
Features: Largefile NTLM SSL SSPI libz


$ b $ p

我在 SO ,这是尽可能接近该问题的重复,但没有接受解决方案,也没有任何建议适用。

I did find one other posting on SO, and this is as close to a duplicate as possible of that question, but there is no accepted solution there, nor are any of the suggestions applicable either.

有没有人有任何建议如何进一步调试问题和/或得到这个工作?

Does anyone have any suggestions how to further debug the issue and/or get this working?

在尝试多个版本的Curl和/或git之后,我终于安装了一个本地代理服务器和隧道git。我最后使用 cntlm ,但有一些不同的可能工作。

After trying multiple versions of Curl and/or git, I finally installed a local proxy server and tunnel git through there. I ended up using cntlm but there are a few different ones that could have worked.

我仍然不知道为什么curl对我的代理服务器有麻烦,但使用cntlm作为中间人工作正常。

I still don't know why curl is having trouble with my proxy server, but using cntlm as a middleman works fine.