问题描述

git push的时候经常网络连接超时,报错

1
fatal: unable to access 'https://github.com/artemiskami/test.git/': Failed to connect to github.com port 443 after 21042 ms: Couldn't connect to server

已经开启代理的情况下,连接失败,说明git push提交没有走代理

配置代理

查看代理

1
2
git config --global --get http.proxy
git config --global --get https.proxy

配置代理

1
2
git config --global http.proxy 127.0.0.1:7898
git config --global https.proxy 127.0.0.1:7898

取消代理

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

端口号为代理的本地端口

image-20240831184035948

参考文档https://zhuanlan.zhihu.com/p/670646102