查看本地Socks5端口

# 代理里边的1080请根据你自身的端口进行修改(socks5协议)
git config --global https.proxy socks5://127.0.0.1:1080
git config --global http.proxy socks5://127.0.0.1:1080

或者仅对github走代理

# 1080端口修改成自己的代理端口(socks5协议)
git config --global http.https://github.com.proxy socks5://127.0.0.1:1080
git config --global https.https://github.com.proxy socks5://127.0.0.1:1080

检查是否完成

#查看当前配置信息(全局)
git config --global --list

编写配置信息

git config --global --edit

取消代理

# 取消全局代理
git  config --global --unset http.proxy #取消http代理
git  config --global --unset https.proxy #取消https代理
# 取消github代理
git config --global --unset http.https://github.com.proxy #取消http代理
git config --global --unset https.https://github.com.proxy #取消https代理

转自22k's Blog