命令行下的代理设置

为了科学上网,访问github之类的快一些,总要在命令行工具下用代理,于是就有了如下设定

# Setup commandline proxy
_proxy="http://127.0.0.1:16888"
_noproxy="localhost,.sina.com.cn,.weibo.com"
alias proxyon="export http_proxy=${_proxy} https_proxy=${_proxy} no_proxy=${_noproxy}"
alias proxyoff="unset http_proxy https_proxy no_proxy"

这个no_proxy是为了让本地内网的repo不要走代理.sina.com.cn代表了该域名下的内容都不走代理。

sudoers里写上环境变量的保持,

Defaults    env_keep += "http_proxy https_proxy no_proxy"

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.