在之前进行git push origin main的时候总是报连接超时问题,我觉得应该是网的问题,多提交几遍就可以了,直到今天,实在是忍受不了了。

1
fatal: unable to access 'https://github.com/name/RepositoryName.git/': Failed to connect to github.com port 443 after 21041 ms: Timed out

在网上找了些解决方案,直接上结果:

1
2
3
4
5
6
7
8
9
# 先取消设置
git config --global --unset http.proxy
git config --global --unset https.proxy
# http 端口号是可以自己更改的,要选择不被占用的端口号
git config --global http.proxy "http://127.0.0.1:9050"
git config --global https.proxy "http://127.0.0.1:9050"
# socks5
git config --global http.proxy "socks5://127.0.0.1:1080"
git config --global https.proxy "socks5://127.0.0.1:1080"

就可以了。