git设置HTTP代理

git设置HTTP代理

设置HTTP代理

如果公司使用代理,git就需要设置代理才能克隆远程仓库

执行下面两条语句

git config --global http.proxy 10.167.32.133:8080
git config --global https.proxy 10.167.32.133:8080

如果需要用户名和密码

git config –global http.proxy http://user:password@10.167.32.133:8080
git config –global http.proxy https://user:password@10.167.32.133:8080

然后就可以使用

git clone http://github.com/weiheli/sass-zh.git
# 或
git clone http://github.com/weiheli/sass-zh.git

不能用

git clone git@github.com:weiheli/sass-zh.git

删除HTTP代理

git config --system (或 --global 或 --local) --unset http.proxy
git config --system (或 --global 或 --local) --unset https.proxy

GitHub Desktop

如果使用Github推出的桌面程序GitHub Desktop,里面可能并没有代理设置的选项,不过这些客户端一般在底层都是调用的命令行工具,所以同样按照上述步骤进行设置即可。

posted @ 2018-04-03 17:24  GordonDicaprio  阅读(259)  评论(0编辑  收藏  举报