Git:在 CONNECT 后从代理收到 HTTP 代码 503
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31588869/
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
Git: Received HTTP code 503 from proxy after CONNECT
提问by 0x44656e6e795279616e
I checked a lot of post related to this issue, but nothing seems to fix my problem. So now I hope you guys can give me the magic answer.
我检查了很多与此问题相关的帖子,但似乎没有什么能解决我的问题。所以现在我希望你们能给我神奇的答案。
I'm using Intellij (but also tried it with SourceTree) to pull/push/clone a repository from Fisheye. However I'm receiving the error:
我正在使用 Intellij(但也尝试使用 SourceTree)从 Fisheye 拉/推/克隆存储库。但是我收到错误:
git -c diff.mnemonicprefix=false -c core.quotepath=false fetch origin
fatal: unable to access 'https://myUser@myUrl/fisheye/git/myRepo.git/': Received HTTP code 503 from proxy after CONNECT
Hints about 503 means a temporary downtime due to maintenance don't work for me, since this issue last for a week now.
关于 503 的提示意味着由于维护而导致的临时停机对我不起作用,因为这个问题已经持续了一周。
Hints about wrong/missing proxy settings don't seem to work either. I setup http and https proxy for system git and for the IDE (Intellij).
关于错误/缺少代理设置的提示似乎也不起作用。我为系统 git 和 IDE (Intellij) 设置了 http 和 https 代理。
It worked before, I was able to clone the repository. Then I created a new branch, made some changes and wanted to push it back to the master.
它以前有效,我能够克隆存储库。然后我创建了一个新分支,进行了一些更改,并希望将其推送回 master。
I really looking forward for some clever tips.
我真的很期待一些聪明的提示。
Thanks so far
到目前为止谢谢
UPDATE
更新
I added:
我补充说:
export GIT_TRACE_PACKET=1
export GIT_TRACE=1
export GIT_CURL_VERBOSE=1
export GIT_TRACE_PACKET=1
export GIT_TRACE=1
export GIT_CURL_VERBOSE=1
and I received the following log:
我收到以下日志:
$ git fetch
trace: built-in: git 'fetch'
trace: run_command: 'git-remote-https' 'origin' 'https://[email protected]/randomGit.git/'
* Couldn't find host myWebService in the _netrc file; using defaults
* Trying 15.46.16.11...
* Connected to myProxy.com (15.46.16.11) port 8080 (#0)
* Establish HTTP proxy tunnel to myWebService.de:443
> CONNECT myWebService.de:443 HTTP/1.1
Host: webapp-entw.mlp.de:443
User-Agent: git/1.9.5.msysgit.1
Proxy-Connection: Keep-Alive
Pragma: no-cache
< HTTP/1.1 503 Service Unavailable
< Cache-Control: no-cache
< Pragma: no-cache
< Content-Type: text/html; charset=utf-8
< Proxy-Connection: close
< Connection: close
< Content-Length: 732
<
* Received HTTP code 503 from proxy after CONNECT
* Closing connection 0
fatal: unable to access 'https://[email protected]/randomGit.git/': Received HTTP code 503 from proxy after CONNECT
采纳答案by 0x44656e6e795279616e
I discovered that my proxy doesn't recognizes the webapp address, so I installed Privoxy and told him to pass every request except those, which are intended for my git. And it works.
我发现我的代理无法识别 webapp 地址,所以我安装了 Privoxy 并告诉他传递所有请求,除了那些用于我的 git 的请求。它有效。
So if I have to connect to the repository I skip the proxy and connect directly.
因此,如果我必须连接到存储库,我会跳过代理并直接连接。
回答by cmbind55
I was having this same error code. For me, the symptom was that I could successfully push to a remote repo, but not pull... In my case, it appeared to turn out to be a name resolution issue.
我有同样的错误代码。对我来说,症状是我可以成功推送到远程存储库,但不能拉...就我而言,这似乎是名称解析问题。
First, I found these settings to shed more light on the network events.
首先,我发现这些设置更能说明网络事件。
export GIT_TRACE_PACKET=1
export GIT_TRACE=1
export GIT_CURL_VERBOSE=1
With these settings, I received a trace like this:
通过这些设置,我收到了这样的跟踪:
PROMPT$ git pull
...
15:21:17.015575 run-command.c:351 trace: run_command: 'git-remote-https' 'origin' 'https://gitub.com/USERNAME/REPO'
* Couldn't find host gitub.com in the .netrc file; using defaults
* Hostname was NOT found in DNS cache
* Trying PROXY-SERVER-IP-ADDRESS...
* Connected to (PROXY-SERVER-IP-ADDRESS) port 80 (#0)
* Establish HTTP proxy tunnel to gitub.com:443
> CONNECT gitub.com:443 HTTP/1.1
Host: gitub.com:443
User-Agent: git/2.3.2 (Apple Git-55)
Proxy-Connection: Keep-Alive
Pragma: no-cache
< HTTP/1.1 503 Service Unavailable
< Cache-Control: no-cache
< Pragma: no-cache
< Content-Type: text/html; charset=utf-8
< Proxy-Connection: close
< Connection: close
< Content-Length: 787
<
* Received HTTP code 503 from proxy after CONNECT
* Connection #0 to host PROXY-SERVER-IP-ADDRESS left intact
fatal: unable to access 'https://gitub.com/USERNAME/REPO/': Received HTTP code 503 from proxy after CONNECT
I did some pinging to github.com, then www.github.com, and noticed some different results. This prompted me to update my origin URL as follows.
我对 github.com 和 www.github.com 进行了一些 ping 操作,发现了一些不同的结果。这促使我按如下方式更新我的源 URL。
git remote set-url origin https://www.github.com/USERNAME/REPO
Simply adding "www." into the origin URL resolved my connection issue in this case. No more 503s -- push and pulls both succeed.
只需添加“www”。在这种情况下,进入原始 URL 解决了我的连接问题。没有更多的 503 了——推和拉都成功了。
UPDATE
更新
Based on your updated trace, this looks very similar to the issue that I had. What you might try is to temporarily substitute the actual IP address of the repository server that you are using (rather than hostname). If that works, then look into solutions for name resolution, like perhaps modifying /etc/hosts. Also, can you confirm that you tried git remote set-url origin to include the full hostname and not just the domain name?
根据您更新的跟踪,这看起来与我遇到的问题非常相似。您可能会尝试临时替换您正在使用的存储库服务器的实际 IP 地址(而不是主机名)。如果可行,请查看名称解析的解决方案,例如修改 /etc/hosts。另外,您能否确认您是否尝试过 git remote set-url origin 来包含完整的主机名而不仅仅是域名?