git clone time out


问题:

当使用git clone东西时,开启了vpn可以访问git 官网,但是克隆会报错超时,需要手动配置一下代理

解决方法:

1. 配置 git 的代理

git config --global http.proxy "127.0.0.1:1080"  
git config --global https.proxy "127.0.0.1:1080"  

这里是关键:需要本地启动 vpn (最后的1080是端口号,如果提示端口冲突,可以自己换一个)

取消代理

git config --global --unset http.proxy

git config --global --unset https.proxy

2. 使用 https 方式  clone

$ git clone https://github.com/xxx.git

注意:这里必须使用 https 方式, ssh 方式即使配置了 git 的代理也不好使。。。

相关