This post is from a low-reputation account and contains an unverified outbound link. Be cautious before clicking external links.

在终端中为git、curl等设置代理

a186r(25)
Published in
#linux
Words
129
Reading
1 min
Listen
Play
8y

在linux中使用了ssr之后,会发现git和curl等无法完成请求,最好的方法还是刷极路由固件,完成彻彻底底的翻墙,或者就直接给git和curl设置代理,方法如下:

给git设置代理:

git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'

取消git代理:

git config --global --unset http.proxy
git config --global --unset https.proxy

使curl走代理

sudo vim ~/.curlrc
然后加入一行:
socks5 = "127.0.0.1:1080"

在终端中为git、curl等设置代理 | Ecency