Git:连接代理后收到 HTTP 代码 503。

8
我查看了很多与这个问题相关的帖子,但似乎没有解决我的问题。现在我希望你们能给我一个神奇的答案。 我正在使用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
503错误通常意味着由于维护而导致的临时停机,但这个问题已经持续了一个星期,所以这些提示对我来说不起作用。 有关错误/丢失代理设置的提示似乎也无效。 我为系统git和IDE(Intellij)设置了http和https代理。 它之前可以工作,我能够克隆存储库。 然后我创建了一个新分支,做了一些更改,并想将其推回主分支。 我真的很期望能得到一些聪明的提示。 谢谢目前为止提供的帮助。 更新: 我添加了以下内容: export GIT_TRACE_PACKET=1 export GIT_TRACE=1 export GIT_CURL_VERBOSE=1 然后我收到了以下日志:
$ git fetch
trace: built-in: git 'fetch'
trace: run_command: 'git-remote-https' 'origin' 'https://Username@myWebService.de/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://Username@myWebService.de/randomGit.git/': Received HTTP code 503 from proxy after CONNECT

你能展示一下 git remote -v 的输出吗? - nwinkler
origin https://[myUser]@[myGit].git (fetch) origin https://[myUser]@[myGit].git (push)将上述代码翻译为中文: origin https://[myUser]@[myGit].git (fetch) origin https://[myUser]@[myGit].git (push) - 0x44656E6E79
2个回答

阿里云服务器只需要99元/年,新老用户同享,点击查看详情
3
我遇到了同样的错误代码。对我来说,症状是我可以成功推送到远程仓库,但无法拉取。在我的情况下,似乎问题出在名称解析上。 首先,我发现这些设置可以更好地阐明网络事件。
export GIT_TRACE_PACKET=1
export GIT_TRACE=1
export GIT_CURL_VERBOSE=1
使用这些设置,我收到了以下跟踪结果:
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

我对github.com和www.github.com进行了一些ping操作,发现结果不同。这促使我按照以下方式更新我的origin URL。

git remote set-url origin https://www.github.com/USERNAME/REPO
简单地将 "www." 添加到原始URL中,就在这种情况下解决了我的连接问题。没有更多的503错误——推送和拉取都成功了。 更新 根据您更新的跟踪记录,这看起来与我遇到的问题非常相似。您可以尝试暂时替换您正在使用的存储库服务器的实际IP地址(而不是主机名)。如果那行得通,那么请查看名称解析的解决方案,例如修改 /etc/hosts。另外,请确认您是否尝试使用完整的主机名而不仅仅是域名来设置 git 远程 set-url origin?

那我应该将 origin https://[myUser]@[myGit].git 改为 origin https://www.[myUser]@[myGit].git (push) 吗? - 0x44656E6E79
所以我添加了 export GIT_TRACE_PACKET=1 - 0x44656E6E79

0

我发现我的代理无法识别Web应用程序地址,因此我安装了Privoxy,并告诉它传递除了那些针对我的git的请求之外的所有请求。这很有效。

因此,如果我需要连接到存储库,我会跳过代理直接连接。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,