之前的文章中介绍过使用clash搭建自由上网,文章的最后成果是搭建了一个网页代理服务器,像是电脑一类的设备不用下载软件,可以直接通过设置里面的内置的代理设计就可以实现科学上网。
但是linux系统该如何去使用这个代理呢,我也在网上查找了一下资料,可以通过在命令行设置环境变量来实现。
设置全局代理可以通过这样:
1 2
| export http_proxy=http://127.0.0.1:1080 export https_proxy=https://127.0.0.1:1080
|
设置git服务器的代理可以通过这样
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| //设置全局代理 //http git config --global https.proxy http://127.0.0.1:1080 //https git config --global https.proxy https://127.0.0.1:1080
//使用socks5代理的 例如ss,ssr 1080是windows下ss的默认代理端口,mac下不同,或者有自定义的,根据自己的改 git config --global http.proxy socks5://127.0.0.1:1080 git config --global https.proxy socks5://127.0.0.1:1080
//只对github.com使用代理,其他仓库不走代理 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 //取消github代理 git config --global --unset http.https://github.com.proxy git config --global --unset https.https://github.com.proxy
//取消全局代理 git config --global --unset http.proxy git config --global --unset https.proxy
|