天天看点

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超时问题解决方案

继续阅读