Linux常见代理配置

bash代理

$ vi ~/.bashrc
# http代理
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 ftp_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7891

# 非代理白名单
export no_proxy="localhost, 127.0.0.1, ::1, 192.168.*.*, 10.*.*.*, *.local"

取消bash代理设置

unset http_proxy; unset https_proxy; unset ftp_proxy; unset all_proxy

apt代理

$ sudo vi /etc/apt/apt.conf
Acquire::http::Proxy "http://127.0.0.1:7890";
Acquire::https::Proxy "http://127.0.0.1:7890";
Acquire::ftp::Proxy "http://127.0.0.1:7890";
Acquire::socks5::proxy "socks5://127.0.0.1:7890/";

git代理配置

# 添加git代理
git config --global http.proxy http://127.0.0.1:7890
git config --global https.proxy https://127.0.0.1:7890

# 取消git代理
git config --global --unset http.proxy
git config --global --unset https.proxy
posted @ 2022-09-11 00:00  BuzzWeek  阅读(1076)  评论(0编辑  收藏  举报