git 请求的 URL 返回错误 502,企业?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/44594353/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 05:01:56  来源:igfitidea点击:

The requested URL returned error 502, corporate?

gitgit-clone

提问by Kevin Cai

Does anyone know what the problem seems to be with git? I am getting this error when running running a git cloneto clone from team foundation server(tfs).

有谁知道问题似乎出在git哪里?运行 a git cloneto clone from team foundation server(tfs)时出现此错误。

 fatal: unable to access 'http://website.com/_git/project': The requested URL returned error: 502

回答by objectNotFound

This took me considerable amount of time to troubleshoot and fix this annoying issue.

这花了我相当多的时间来排查和解决这个烦人的问题。

In my case I had the http_proxyand https_proxyenvironment variables set on my PC. ( You can find them under control panel - System and Security - Advanced system settings - Env variables - System variables section bottom panel in windows 10)

就我而言,我在 PC 上设置了http_proxyhttps_proxy环境变量。(您可以在 Windows 10 的控制面板 - 系统和安全 - 高级系统设置 - 环境变量 - 系统变量部分底部面板中找到它们)

Once I deleted those 2 environment variables ( highlight - delete - ok ) and closed the Git-Terminal window and re-opened it the problem (http 502) went away. Just to confirm I tested with Git GUI + VS Code + Git Term. Did git fetch/clone/push/etc ...

一旦我删除了这 2 个环境变量( highlight - delete - ok )并关闭 Git-Terminal 窗口并重新打开它,问题(http 502)就消失了。只是为了确认我使用 Git GUI + VS Code + Git Term 进行了测试。git fetch/clone/push/etc...

Note: I am in a corporate env behind a strict proxy but so is the Enterprise tfs URL therefore I do not need a proxy interfering between me and my tfs server. I suspect (cannot confirm or rule out) the proxy was playing a MITM. Client machine is Windows 10 latest build running git version 2.22.0.windows.1

注意:我在严格代理后面的公司环境中,但企业 tfs URL 也是如此,因此我不需要代理干扰我和我的 tfs 服务器。我怀疑(无法确认或排除)代理正在玩 MITM。客户端机器是运行 git 版本2.22.0.windows.1 的Windows 10 最新版本

回答by Guy

For reference: Within a corporate environment behind an authenticating proxy server I had previously edited my git global config an override for the proxy server. Once I corrected this, I was able to connect.

供参考:在身份验证代理服务器后面的公司环境中,我之前编辑了我的 git 全局配置,覆盖了代理服务器。一旦我纠正了这个问题,我就可以连接了。

Useful command:

有用的命令:

git config --global --list


[filter "lfs"]
        clean = git-lfs clean -- %f
        smudge = git-lfs smudge -- %f
        process = git-lfs filter-process
        required = true
[user]
        name = GuyWicks
[user]
        email = [email protected]
[http]
    proxy = http://public-cache:8080

[https]
    proxy = http://public-cache:8080

I commented out the four proxy lines (#)

我注释掉了四个代理行 (#)

回答by Yuvraj

I was running into the same issue. For some reason I had http and Https proxies set up in my git config list. Removing those allowed me to clone successfully.

我遇到了同样的问题。出于某种原因,我在我的 git 配置列表中设置了 http 和 Https 代理。删除那些让我成功克隆。