使用V2ray对Git进行加速

V2rayN或者V2rayU 默认监听 1080/1081 端口,如果修改过默认端口,那么请自行替换下列端口。
Linux 直接在shell中设置,Windows 在 git bash 设置。

# socks5协议,1080端口修改成自己的本地代理端口
git config –global http.proxy socks5://127.0.0.1:1080
git config –global https.proxy socks5://127.0.0.1:1080
# http协议,1081端口修改成自己的本地代理端口
git config –global http.proxy http://127.0.0.1:1081
git config –global https.proxy https://127.0.0.1:1081

如果只是加速GITHUB , 其他保持不变。 设置如下:

# http协议
git config –global http.https://github.com.proxy https://127.0.0.1:1081
git config –global https.https://github.com.proxy https://127.0.0.1:1081
# socks5协议,1080端口修改成自己的本地代理端口
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 -l
reset 代理设置
git config –global –unset http.proxy
git config –global –unset https.proxy

Windows CMD 设置代理参见资料:
Windows git和cmd代理设置