解決git無法連接gitHub問題
事情的起因
我在使用git push我的項目時出現(xiàn)下面問題
fatal: unable to access ‘https://github.com/xxx.git/’: Recv failure: Connection was reset
或者
fatal: unable to access ‘https://github.com/xxx.git/’: Failed to connect to github.com port 443 after 21090 ms: Couldn’t connect to server
翻譯過來就是無法連接到github
分析原因
-
檢查網(wǎng)絡(luò)
無法連接一般是網(wǎng)絡(luò)不行或者網(wǎng)絡(luò)不穩(wěn)定,使用瀏覽器訪問github看看是否正常,如果瀏覽器無法訪問或者加載的不是完整頁面使用git可能就出現(xiàn)上面的問題
-
檢查代理
因為github訪問比較慢,很多人都使用了代理,我也一樣
看一下自己是不是開了代理或者開過代理,為什么要講開過呢?因為有些代理軟件會修改系統(tǒng)配置參數(shù)一些問題
解決方法
-
瀏覽器無法訪問github或者訪問顯示不全
換一個好的能訪問github的網(wǎng)絡(luò)或者開代理
-
代理問題
一般是開了代理能正常訪問github但是使用git命令連接不上github
給git設(shè)置代理可以解決
以我為例,開了代理,可以瀏覽器可以正常訪問github,代理的端口是10809
查看git配置 git config --global -l
> git config --global -l user.name=xxxx user.email=xxxx
可以看到我的git是沒設(shè)置代理的
給git設(shè)置代理
git config --global http.proxy 127.0.0.1:10809
git config --global https.proxy 127.0.0.1:10809> git config --global http.proxy 127.0.0.1:10809 > git config --global https.proxy 127.0.0.1:10809
再次查看git配置 git config --global -l
> git config --global -l user.name=xxx user.email=xxx http.proxy=127.0.0.1:10809 https.proxy=127.0.0.1:10809
使用git pull看看
> git pull Already up to date.
正常了
還有一個問題是沒開代理但是git設(shè)置了代理也會出現(xiàn)上面問題,解決方法是取消git代理文章來源:http://www.zghlxwxcb.cn/news/detail-775182.html
git config --global --unset https.proxy
git config --global --unset http.proxy文章來源地址http://www.zghlxwxcb.cn/news/detail-775182.html> git config --global --unset http.proxy > git config --global --unset https.proxy > git config --global -l user.name=xxx user.email=xxx
到了這里,關(guān)于解決git無法連接gitHub問題的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!