前阵子入职,公司用的是内网,需要设置代理,所以在学习git的使用过程中遇到了很多问题,都是这个代理设置导致的,各种远程操作不成功,所以在此总结一下git代理的设置,方便使用。

在本地仓库根目录下(有.git文件的那个目录)
设置代理,http://127.0.0.1为我的代理地址,8080是我的端口号,这里你要改成自己的

git config http.proxy http://127.0.0.1:8080

设置全局代理

git config –global http.proxy http://127.0.0.1:8080
git config –global https.proxy http://127.0.0.1:8080

查看是否代理成功

git config –get –global http.proxy

取消代理
git config –global –unset http.proxy
git config –global –unset https.proxy

最后附上廖雪峰老师的git教程网址
https://www.liaoxuefeng.com/wiki/896043488029600