Git clone error “HTTP code 504 from proxy after CONNECT”

孤街浪徒 提交于 2019-12-18 17:34:36

问题


I'm working in a office behind a corporate firewall. My System is windows7, using componentes consola. Usually I need to set up proxy connections to get GIT working with github.

But when I try to clone a repository sored in a private Stash (Atlassian) I get this error:

Cloning into 'apptest'...
fatal: unable to access 'https://xxx@xxx.xx.xx.xx:xxxx/apptest/apptest.git
/': Received HTTP code 504 from proxy after CONNECT

I have unsetted git proxy but I'm still facing same problem. Please note that I'm using GITshell over Windows 7

Any help would be appreciated.

Regards


回答1:


Problem solved.

Windows: Before connecting Bitbucket (AKA stash) you need to clean all proxies from both Git and console environment:

SET HTTP_PROXY=
SET HTTPS_PROXY=
git config --global --unset http.proxy
git config --global --unset https.proxy
git clone http://yourUser@stashAddress:stashPort/apptest.git

But if you need to connect to public repositories like github, then it's necessary to define proxies again:

SET HTTP_PROXY=proxyaddress:port
SET HTTPS_PROXY=proxyaddress:port
git config --global http.proxy http://proxyaddress:port
git config --global https.proxy http://proxyaddress:port

I think it may be useful for other developers working behind corporate firewalls.

Linux

unset HTTP_PROXY
unset HTTPS_PROXY
git config --global --unset http.proxy
git config --global --unset https.proxy
git clone http://yourUser@stashAddress:stashPort/apptest.git

To define proxies again:

export HTTP_PROXY=proxyaddress:port
export HTTPS_PROXY=proxyaddress:port
git config --global http.proxy http://proxyaddress:port
git config --global https.proxy http://proxyaddress:port

Take care with uppercase of environment variables. Some OS versions may need lowercase or may have defined lowercase variables by default.




回答2:


If you definitely need the proxy and can't remove it (eg: if you're on a corporate proxy) then just use the ssh to clone the repo.



来源:https://stackoverflow.com/questions/34748475/git-clone-error-http-code-504-from-proxy-after-connect

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!