Git向Github push时,连接超时
Failed to connect to github.com port 443: Timed out
问题背景
最近在使用Git向Github提交时总是会出现以下报错:
E:\hugo\Sites\blog\public>git push -u origin master
fatal: unable to access 'https://github.com/sin-coder/sin-coder.github.io.git/': Failed to connect to github.com port 443: Timed out
而且还是偶尔出现的,特别让人心烦,目测为网络问题,折腾了许久在StackOverflow找到了答案
问题原因
为了访问Github更加流畅,本地使用了Shadowsocks进行代理,可是Git并没有走代理访问
只需将Git配置为代理访问Github即可
解决措施
打开Windows下的cmd命令行,在命令行中直接输入以下命令(已经配置Git的环境变量),或者
切换到Git的安装目录下执行命令(未配置环境变量)即可解决该问题
E:\Program Files\Git\Git 的目录
2019/11/27 13:19 <DIR> .
2019/11/27 13:19 <DIR> ..
2019/11/27 13:18 <DIR> bin
2019/11/27 13:19 <DIR> cmd
2019/11/27 13:19 <DIR> dev
2019/11/27 13:19 <DIR> etc
2019/02/26 19:48 149,784 git-bash.exe
2019/02/26 19:48 149,272 git-cmd.exe
2018/03/12 17:58 18,765 LICENSE.txt
2019/11/27 13:18 <DIR> mingw64
2019/02/26 20:10 144,911 ReleaseNotes.html
2019/11/27 13:19 <DIR> tmp
2019/11/27 13:19 1,203,442 unins000.dat
2019/11/27 13:18 1,297,048 unins000.exe
2019/11/27 13:19 22,795 unins000.msg
2019/11/27 13:19 <DIR> usr
7 个文件 2,986,017 字节
9 个目录 115,342,643,200 可用字节
E:\Program Files\Git\Git>git config --global http.proxy http://127.0.0.1:1080
E:\Program Files\Git\Git>git config --global https.proxy http://127.0.0.1:1080