git - 企业代理 Azure Devops 与 Git

标签 git azure-devops

我在 Azure Dev-Ops 中创建了一个项目和 Repo。 我们正坐在一个公司代理后面,想从这个项目中克隆。

我已将环境变量 http_proxy、https_proxy、HTTP_PROXY、HTTPS_PROXY、git config --global https.proxy、git config --global http.proxy 设置为下面匹配的 http 或 https 版本 http://domain\username:password@ProxAddr:Proxy 或者 https://domain\username:password@ProxAddr:Proxy

当我运行 git clone https://username:pwd@dev.azure.com/username/ProjectName/_git/RepoName 时,我收到以下错误。

Cloning into 'ProjectName'...
* Couldn't find host dev.azure.com in the .netrc file; using defaults
*   Trying {proxyip} ...
* Connected to {proxyip} ({proxyip}) port {proxyport} (#0)
* Establish HTTP proxy tunnel to dev.azure.com:443
> CONNECT dev.azure.com:443 HTTP/1.1
Host: dev.azure.com:443
User-Agent: git/2.7.4
Proxy-Connection: Keep-Alive

< HTTP/1.1 407 Proxy Authentication Required
< Proxy-Authenticate: NEGOTIATE
< Proxy-Authenticate: NTLM
< Proxy-Authenticate: BASIC realm="{CORPRELM}"
< Cache-Control: no-cache
< Pragma: no-cache
< Content-Type: text/html; charset=utf-8
< Proxy-Connection: close
< Connection: close
< Content-Length: 849
<
* Ignore 849 bytes of response-body
* Connect me again please
* found 148 certificates in /etc/ssl/certs/ca-certificates.crt
* found 592 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* gnutls_handshake() failed: Error in the push function.
* Closing connection 0
* Couldn't find host dev.azure.com in the .netrc file; using defaults
* Hostname {proxyip} was found in DNS cache
*   Trying {proxyip}...
* Connected to {proxyip} ({proxyip}) port {proxyport}(#1)
* Establish HTTP proxy tunnel to dev.azure.com:443
> CONNECT dev.azure.com:443 HTTP/1.1
Host: dev.azure.com:443
User-Agent: git/2.7.4
Proxy-Connection: Keep-Alive

< HTTP/1.1 407 Proxy Authentication Required
< Proxy-Authenticate: NEGOTIATE
* gss_init_sec_context() failed: : SPNEGO cannot find mechanisms to negotiate
< Proxy-Authenticate: NTLM
< Proxy-Authenticate: BASIC realm="{CORPREALM}"
< Cache-Control: no-cache
< Pragma: no-cache
< Content-Type: text/html; charset=utf-8
< Proxy-Connection: close
< Connection: close
< Content-Length: 849
<
* Received HTTP code 407 from proxy after CONNECT
* Closing connection 1
fatal: unable to access 'https://username:devopspwdF@dev.azure.com/username/DevOpsProject/_git/DevOpsRepo/': gnutls_handshake() failed: Error in the push function.

错误似乎是这样的?

< Proxy-Authenticate: NEGOTIATE
* gss_init_sec_context() failed: : SPNEGO cannot find mechanisms to negotiate

我需要明确说明什么吗?

最佳答案

看起来您的代理可能配置错误,并且提供了它不支持的身份验证机制(在本例中为协商)。您可以通过将 http.proxyAuthMethod 选项设置为合适的值来解决此问题。根据输出,您可能希望使用 ntlmbasic

此外,您可以通过对所有 HTTPS URL 使用 git config http.https://*.azure.com/.proxyAuthMethod ntlm 之类的东西,在每个 URL 或模式的基础上进行设置主机名与 *.azure.com 匹配。

关于git - 企业代理 Azure Devops 与 Git,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53600903/

相关文章:

git 远程存储库包含未 merge 到本地分支的提交

git - 使用 VSTS API 在 VSTS 中的持续集成/持续交付过程中将文件提交到 Git

Azure持续部署总是失败

git add 不会拾取添加到现有目录的新文件

git - Azure DevOps - pull 请求 Git "Next steps: Manually resolve these conflicts and push new changes to the source branch."

git - 如何将父级添加到 git 中的提交?

git - 如何从损坏的 git 工作文件夹中恢复文件

linux - 在linux上 Electron 版本无法定期创建rpm包

azure-devops - azure devops 变量组

azure-devops - Az CLI : Cannot run pipeline with runtime parameters