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

标签 git intellij-idea proxy atlassian-sourcetree http-status-code-503

我检查了很多与此问题相关的帖子,但似乎没有什么可以解决我的问题。所以现在我希望你们能给我神奇的答案。

我正在使用 Intellij(但也尝试过使用 SourceTree)从 Fisheye pull/推/克隆存储库。但是我收到错误:

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 代理。

它之前有效,我能够克隆存储库。然后我创建了一个新的分支,做了一些修改,想把它推回给master。

我真的很期待一些聪明的技巧。

谢谢

更新

我补充说:

导出 GIT_TRACE_PACKET=1 导出 GIT_TRACE=1 导出 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

最佳答案

我遇到了同样的错误代码。对我来说,症状是我可以成功推送到远程存储库,但不能 pull ...就我而言,这似乎是名称解析问题。

首先,我发现这些设置可以更清楚地了解网络事件。

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 操作,发现了一些不同的结果。这促使我按如下方式更新我的原始 URL。

git remote set-url origin https://www.github.com/USERNAME/REPO

只需添加“www”。在这种情况下,进入原始 URL 解决了我的连接问题。不再有 503——推和 pull 都成功。

更新

根据您更新的跟踪记录,这看起来与我遇到的问题非常相似。您可能会尝试暂时替换您正在使用的存储库服务器的实际 IP 地址(而不是主机名)。如果可行,则研究名称解析的解决方案,例如修改/etc/hosts。另外,您能否确认您尝试过 git remote set-url origin 来包含完整的主机名而不仅仅是域名?

关于Git:连接后从代理收到 HTTP 代码 503,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31588869/

相关文章:

git - 忽略已 checkin 目录的内容?

tomcat - 在 IntelliJ 中运行 Tomcat 时,如何更改控制台中 [INFO] 的颜色?

intellij-idea - 在 IntelliJ 中运行 Groovy 脚本失败

java - 在代理服务器中建立 HTTPS 连接时出现问题。(CONNECT 方法)

Java - 获取接口(interface)中方法的签名,其代理实现也是如此

Java HTTP 代理。何时关闭套接字?

git - 为什么 Github Pull 请求的基本分支文件(左侧)显示的内容与 HEAD 版本不同?

git - 如何从 ubuntu 终端在 github 帐户中推送新的本地存储库?

Git:恢复存储在分支A中、在分支B中删除的文件

grails - Intellij11/Grails 2.0.1编译错误 “BUG! exception in phase '语义分析'”