由于众所周知的原因,在国内使用github时的时候网络就像蜗牛速度一样,虽然国内也有码云可以使用,但是很多优秀开源项目基本都在github上,所以总要想点解决办法,虽然网上有推荐修改host文件来提高速度,但是我发现好像并没什么鸟用,不过还好git提供了使用代理方式,所以特此记录下.
点击查看Git学习教程
代理设置
# 走http和https代理
git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
# 走socks5代理,两者取其一
git config --global http.proxy socks5://127.0.0.1:1080
git config --global https.proxy socks5://127.0.0.1:1080
# 修改用户目录下的.gitconfig配置文件
[https]
proxy = socks5://127.0.0.1:1080
[http]
proxy = socks5://127.0.0.1:1080
取消代理设置
git config --global --unset http.proxy
git config --global --unset https.proxy
查看代理设置
git config --global --get http.proxy
git config --global --get https.proxy