天天看點

Git上傳代碼到GitHub逾時問題解決方案

作者:IT小村
Git上傳代碼到GitHub逾時問題解決方案

背景

Git上傳代碼到GitHub逾時問題解決方案

筆者在GitHub上面建立新的代碼倉庫,再講本地的項目代碼,上傳到GitHub上面時,偶爾會出現這種失敗現象,檔案說明是逾時了

hongcunlin@bogon springboot-struts2 % git remote add origin https://github.com/larger5/springboot-struts2.git
hongcunlin@bogon springboot-struts2 % git push -u origin master
fatal: unable to access 'https://github.com/larger5/springboot-struts2.git/': Failed to connect to github.com port 443 after 75005 ms: Operation timed out           

方案

在網上了解了很多對策,目前最簡單有效的,就是取消代理,便能解決這個問題,即執行以下指令。

git config --global --unset http.proxy
git config --global --unset https.proxy           

效果

執行完指令,再上傳代碼,很快就上傳上去了,真是立竿見影。

Git上傳代碼到GitHub逾時問題解決方案

至于截圖中的内容,如下:

hongcunlin@bogon springboot-struts2 % git config --global --unset http.proxy
hongcunlin@bogon springboot-struts2 % git config --global --unset https.proxy
hongcunlin@bogon springboot-struts2 % git push -u origin master
Enumerating objects: 32, done.
Counting objects: 100% (32/32), done.
Delta compression using up to 10 threads
Compressing objects: 100% (20/20), done.
Writing objects: 100% (32/32), 60.81 KiB | 20.27 MiB/s, done.
Total 32 (delta 0), reused 0 (delta 0), pack-reused 0
To https://github.com/larger5/springboot-struts2.git
 * [new branch]      master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.           

其他

本文分享了Git上傳代碼到GitHub逾時的解決方法,希望對你有是以幫助,後續遇到類似的問題,有一些比較好的解決方案,也會做些分享。

Git上傳代碼到GitHub逾時問題解決方案

繼續閱讀