1. 全局代理设置
# 基于http/https进行代理
git config --global http.proxy http://127.0.0.1:1080
# 基于Socks5进行代理
git config --global http.proxy socks5://127.0.0.1:7890
全局代理,上述两条命令任选其一即可(一般代理软件支持Socks5)。
取消全局代理的话,命令如下所示:
git config --global --unset http.proxy
2. 当前仓库代理设置
git clone https://github.com/megaease/easegress.git --config "http.proxy=127.0.0.1:7890"
针对当前仓库,设置如上所示。
3.针对指定域名设置代理
# 以 Github 为例
git config --global http.https://github.com.proxy http://127.0.0.1:7890
# 以 Github 为例
git config --global http.https://github.com.proxy socks5://127.0.0.1:7890