全部代理
git 所有的访问都使用代理:
git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy http://127.0.0.1:1080
部分代理
只针对 github.com 设置代理:
# 只设置这一条即可。注意不是 https.https:github.com.proxy
git config --global http.https://github.com.proxy http://127.0.0.1:1080
临时代理
直接在 git 命令行中临时使用代理:
git clone https://github.com/user/repo.git -c http.proxy=http://127.0.0.1:1080
取消代理
git config --global --unset http.proxy
git config --global --unset https.proxy
git config --global --unset http.https://github.com.proxy
查看代理
git config --global --list