GitHub push超时怎么办

写代码的时候,想要在公司和家里互相连通并且有记录可以查看,所以准备使用GitHub对代码做管理。

但是有一个问题就是git上传的时候,很容易就time out超时了。

这里我们只需要设置git的代理就行。

1
2
3
4
5
6
7
8
9
10
11
# 配置socks5代理
git config --global http.proxy socks5 127.0.0.1:7890
git config --global https.proxy socks5 127.0.0.1:7890

# 配置http代理
git config --global http.proxy 127.0.0.1:7890
git config --global https.proxy 127.0.0.1:7890

# 取消http代理:
git config --global --unset http.proxy
git config --global --unset https.proxy

之后在上传就直接上传成功了,非常的方便。