git 使用 ssl 拦截推送代理

git push behind proxy with ssl interception

我的 git 客户在公司代理后面。该代理进行 ssl 拦截。

我设法用 git config --global http.sslcainfo PATH-TO-PROXY-CA-CERT

抑制了 SSL 证书问题

现在我可以通过 https(ssh 被阻止)从 github/bitbucket/gitlab/... 克隆存储库

但每当我必须进行身份验证时(例如,为了私人回购或推送某些东西),我有时也会收到消息 fatal: Authentication failed for ...

remote: Anonymous access to ... denied.
fatal: Authentication failed for '...'

为什么会出现这些错误,我该怎么做才能让它正常工作?

另请注意,在设置代理时,如果您的密码包含 @ 或任何特殊字符,则会出现身份验证问题。您需要在设置代理时转义它。

如果您在公司防火墙后面,并且如果您的所有请求都通过代理服务器,那么您必须先设置 Git 代理,然后再 运行 任何获取命令,如拉取、获取和推送命令.

要为 HTTP 和 HTTPS 设置 Git 代理,请在 git bash shell

中使用以下 Git 命令
git config --global http.proxy http://username:password@proxy.server.com:8080
git config --global https.proxy http://username:password@proxy.server.com:8080

//Replace username with your proxy username
//Replace password with your proxy password
//Replace proxy.server.com with the proxy domain URL.
//Replace 8080 with the proxy port no configured on the proxy server.

查看How to configure Git proxy and How to unset the Git Proxy了解更多详情

解决方案:在这种情况下,公司代理出于安全原因删除了凭据。