在 win10 中为 git 命令设置代理(v2rayN)
在win10中为git命令设置代理,代理软件为v2rayN,有两种设置方式:http
和scoks
1. 设置scoks
代理
在参数设置
–Core:基础设置
中可以查看本地socks
端口号,一般为1080。 在命令行中使用以下命令设置git代理:
git config --global http.proxy socks5://127.0.0.1:1080
git config --global https.proxy socks5://127.0.0.1:1080
2. 设置http
代理
不知道本地http
端口是在哪设置的,应该是和socks
端口号有关。 把v2rayN设为全局模式,打开win10的设置中代理,可以看到socks
端口号,我这里是1081。 在命令行中使用以下命令设置git代理:
git config --global http.proxy http://127.0.0.1:1081
git config --global https.proxy https://127.0.0.1:1081
3. 取消代理设置
git config --global --unset http.proxy
git config --global --unset https.proxy
注意:
- 在执行
git clone
时,该方法只适用于http方式,不适用于ssh方式。ssh方式推荐使用proxychains(linux)。
参考文章:
技术交流Q群: 1012481075 群内有各种流行书籍资料
原文链接:https://hugueliu.github.io/2019/12/25/config_git_proxy_with_v2ray_in_win10/
原文链接:https://hugueliu.github.io/2019/12/25/config_git_proxy_with_v2ray_in_win10/