首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在git中再次出现代理问题(在Linux上隐藏NTLM代理)

在git中再次出现代理问题(在Linux上隐藏NTLM代理)
EN

Stack Overflow用户
提问于 2018-04-17 08:41:27
回答 1查看 554关注 0票数 0

在Linux机器上,我想在NTLM代理后面克隆GitHub存储库。

我知道这里关于Stackoverflow (如ABC)中关于git和代理的答案,并根据它们做了以下工作:

在我的.gitconfig中,我将代理信息设置为

代码语言:javascript
复制
[http]
    sslVerify = false
    proxy = http://<user>:<password>@<ip-adress>:<port-number>
[https]
    sslVerify = false
    proxy = http://<user>:<password>@<ip-adress>:<port-number>

(注意:我也尝试过不禁用SSL。)

此外,我还设置了环境变量。

代码语言:javascript
复制
HTTP_PROXY=http://<user>:<password>@<ip-adress>:<port-number>
HTTPS_PROXY=http://<user>:<password>@<ip-adress>:<port-number>

用于底层curl调用。

但我还是联系不上。例如,我发布

代码语言:javascript
复制
git clone http://github.com/doorOfChoice/json-view

如果事先通过export GIT_CURL_VERBOSE=1打开调试输出,则会得到以下错误消息输出:

代码语言:javascript
复制
Cloning into 'json-view'...
* Couldn't find host github.com in the .netrc file; using defaults
* About to connect() to proxy <ip-address> port <port-number> (#0)
*   Trying <ip-address>... * Connected to <ip-address> (<ip-address>) port <port-number> (#0)
> GET http://github.com/doorOfChoice/json-view/info/refs?service=git-upload-pack HTTP/1.1
User-Agent: git/2.6.0
Host: github.com
Accept: */*
Accept-Encoding: gzip
Proxy-Connection: Keep-Alive
Accept-Language: en-US, *;q=0.9
Pragma: no-cache

< HTTP/1.1 407 Proxy Access Denied
< Expires: 0
< Server: WebMarshal Proxy
< Cache-Control: no-cache
< Connection: keep-alive
< Proxy-Connection: keep-alive
< Via: 1.1 WEBMARSHAL
< Content-Length: 2339
< Content-Type: text/html; charset=utf-8
< Proxy-Authenticate: Negotiate
< Proxy-Authenticate: NTLM
< Proxy-Authenticate: Basic realm="WebMarshal Proxy Server"
< X-WebMarshal-RequestID: <request-id>
< 
* Ignoring the response-body
* Expire cleared
* Connection #0 to host <ip-address> left intact
* Issue another request to this URL: 'http://github.com/doorOfChoice/json-view/info/refs?service=git-upload-pack'
* Couldn't find host github.com in the .netrc file; using defaults
* Re-using existing connection! (#0) with host <ip-address>
* Connected to <ip-address> (<ip-address>) port <port-number> (#0)
> GET http://github.com/doorOfChoice/json-view/info/refs?service=git-upload-pack HTTP/1.1
User-Agent: git/2.6.0
Host: github.com
Accept: */*
Accept-Encoding: gzip
Proxy-Connection: Keep-Alive
Accept-Language: en-US, *;q=0.9
Pragma: no-cache

< HTTP/1.1 407 Proxy Access Denied
< Expires: 0
< Server: WebMarshal Proxy
< Cache-Control: no-cache
< Connection: keep-alive
< Proxy-Connection: keep-alive
< Via: 1.1 WEBMARSHAL
< Content-Length: 2339
< Content-Type: text/html; charset=utf-8
* gss_init_sec_context() failed: : Credentials cache file '<tmp-file>' not found< Proxy-Authenticate: Negotiate
< Proxy-Authenticate: NTLM
< Proxy-Authenticate: Basic realm="WebMarshal Proxy Server"
< X-WebMarshal-RequestID: <request-i>dstack
< 
* Connection #0 to host <ip-address> left intact
fatal: unable to access 'http://github.com/doorOfChoice/json-view/': The requested URL returned error: 407

奇怪的是,curl 自己的作品!那么git和curl之间的抓取有什么不同呢?如何使git clone <URL>在这种代理的背后工作?

EN

回答 1

Stack Overflow用户

发布于 2018-04-18 04:41:55

通过深入研究StackOverflow,我找到了答案(比如AB),建议cntlm --这终于奏效了!以下几点也是如此:

在您的计算机上安装cntlm,使用代理凭据设置配置文件,启动cntlmd作为服务,并从现在起在所有其他工具上指向cntlm代理(默认情况下是http://127.0.0.1:3128)。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49873505

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档