Git Fatal: unable to access Failed to connect to 127.0.0.1 port 1080: Connection refused

很奇怪,我在國內(nèi)的時候開ss用git用得好好的,現(xiàn)在人在米國不需要ss了,git確連接不上。
今天斷了ss, push之后出來這個錯誤提示:

fatal: unable to access 'http://.../spring-mvc.git/': Unable to receive initial SOCKS5 response.

然后按照 git 設(shè)置和取消代理 里的方法:

git config --global https.proxy http://127.0.0.1:1080

git config --global https.proxy https://127.0.0.1:1080

git config --global --unset http.proxy

git config --global --unset https.proxy

npm config delete proxy

# 只對github.com
git config --global http.https://github.com.proxy socks5://127.0.0.1:1080
git config --global --unset http.https://github.com.proxy

然后繼續(xù)報錯:

fatal: unable to access 'http://.../spring-mvc.git/': Failed to connect to 127.0.0.1 port 1080: Connection refused

然后按照git cannot clone or push? failed to connect, connection refused里的方法,繼續(xù):

    This happens because a proxy is configured in git.

    Since it's https proxy (and not http) git config http.proxy and git config --
    global http.proxy can't help.

    1 : take a look at your git configuration

    git config --global -l
   If you have nothing related to https proxy like https_proxy=... the 
   problem is not here.

   If you have something related to https proxy then remove it from the file 
   ~/.gitconfig and try again

   2 : if it still doesn't work, unset environment variables

   Check your environment variables :

   env|grep -i proxy  
   You should have one or several lines with https_proxy=...

   Unset one by one with : unset https_proxy (or HTTPS_PROXY 
   depending of the name of the variable)

   3 : check environment variables again

   env|grep -i proxy

   If it shows nothing you should be good.

   Note : This solution can applies to http and https proxy problems. just 
   the variables name changes from https to http

我在檢查環(huán)境變量時后沒發(fā)現(xiàn)https_proxy=這類的,但是發(fā)現(xiàn)了一個

ALL_PROXY=socks5://127.0.0.1:1080

明顯是代理,然后我在git里輸入了:
unset ALL_PROXY

再次檢查環(huán)境變量,回應(yīng)變成了空白,說明我已經(jīng)取消代理了?

然后我再次push,貌似成功了,問題就此解決。

我關(guān)閉后再次啟動iTerm后發(fā)現(xiàn)又一次出現(xiàn)了同樣的問題,也就是我每次啟動git會默認ALL_PROXY=socks5

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容