各种环境设置代理
一,git
支持socks5或者http代理
全局代理
1
2git config --global http.proxy socks5://ip:port
git config --global https.proxy socks5://ip:port指定github设置代理
1
git config --global http.https://github.com.proxy http://ip:port
二,docker
1 |
|
三,apt
1 |
|
四,android
1 |
|
五,wget/curl
wget
1
2wget -e use_proxy=yes -e https_proxy=http://ip:port https://example.com
wget -e use_proxy=yes -e https_proxy=socks5://ip:port https://example.comcurl
1
2curl -x http://ip:port https://example.com
curl -x socks5://ip:port https://example.com
六,bashrc设置代理脚本
- 在.bashrc中添加以下代码,要使用时在终端执行
setproxy
或者setproxy socks5
命令1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20function setproxy {
echo "set proxy"
if [[ $1 == "del" ]]; then
unset http_proxy
unset https_proxy
unset all_proxy
unset ALL_PROXY
elif [[ $1 == "socks5" ]]; then
echo "set socks5 proxy"
export all_proxy=socks5://ip:port
export ALL_PROXY=socks5://ip:port
else
export http_proxy=http://ip:port
export https_proxy=http://ip:port
fi
echo http_proxy=$http_proxy
echo https_proxy=$https_proxy
echo all_proxy=$all_proxy
echo ALL_PROXY=$ALL_PROXY
}
各种环境设置代理
https://hqw700.github.io/2025/09/29/2025-09-29-some-env-proxy-setting/