git 设置 http 代理 - 全局
git config --global http.proxy http://127.0.0.1:1080
git 设置 http 代理 - 域名 https://github.com
git config --global http.https://github.com.proxy http://127.0.0.1:1080
git 设置 socks5 代理 - 全局
git config --global http.proxy socks5h://127.0.0.1:1080
git 设置 socks5 代理 - 域名 https://github.com
git config --global http.https://github.com.proxy socks5h://127.0.0.1:1080
git 取消代理 - 全局
git config --global --unset http.proxy
git 取消代理 - 域名 https://github.com
git config --global --unset http.https://github.com.proxy

如果有username和password需要使用

http://username:password@server:port
https://username:password@server:port
socks5h://username:password@server:port