开启v2ray后,默认端口是10808
对于git的使用,可以配置相应的代理,具体如下:
使用以下命令开启socks代理
git config --global http.proxy socks://127.0.0.1:10808
git config --global https.proxy socks://127.0.0.1:10808
使用以下命令开启http代理
git config --global http.proxy http://127.0.0.1:10808
git config --global https.proxy https://127.0.0.1:10808
注意:
socks代理与http代理不能同时配置,因为config的key相同,会造成覆盖
验证
配置完成后,可以通过 git config --list 查看配置
git config --list
删除github代理
当不需要代理的时候,可以使用如下命令进行删除:
git config --global --unset http.proxy
git config --global --unset https.proxy