0

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

我知道关于和代理的 Stackoverflow(如ABC)上的答案git,并且我按照他们做了以下事情:

在我的.gitconfig我已经设置了代理信息的形式

[http]
    sslVerify = false
    proxy = http://<user>:<password>@<ip-adress>:<port-number>
[https]
    sslVerify = false
    proxy = http://<user>:<password>@<ip-adress>:<port-number>

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

此外,我已经设置了环境变量

HTTP_PROXY=http://<user>:<password>@<ip-adress>:<port-number>
HTTPS_PROXY=http://<user>:<password>@<ip-adress>:<port-number>

用于基础curl调用。

我仍然无法连接。例如我发出

git clone http://github.com/doorOfChoice/json-view

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

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>在这种类型的代理后面工作?

4

1 回答 1

0

通过深入研究 StackOverflow,我得到了建议的答案(如ABcntlm——这终于奏效了!因此,请执行以下操作:

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

于 2018-04-18T04:41:55.913 回答