In .zshrc
or .bashrc
file, write the following commands:
export HTTP_PROXY=http://xxx.xxx.xxx.xxx:port
I found a better way:
# proxy
proxy () {
export http_proxy="http://xxx.xxx.xxx.xxx:port"
export https_proxy=$http_proxy
echo "HTTP Proxy on"
}
# no proxy
noproxy () {
unset http_proxy
unset https_proxy
echo "HTTP Proxy off"
}
Shell is awesome!π
Add the following code in the ~/.profile
, π
host_ip=$(cat /etc/resolv.conf | grep "nameserver" | cut -f 2 -d " ")
export ALL_PROXY="http://$host_ip:7890"
After this, I can use git normally, curl works sometimes, but it seems that wget still not working. Dont know why. The following command works well,
β ~ curl https://raw.githubusercontent.com/aucker/VimConfig/master/.vimrc -o .vimrc
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 4759 100 4759 0 0 4684 0 0:00:01 0:00:01 --:--:-- 4684
but when I use wget
, I got the error:
β ~ wget https://raw.githubusercontent.com/aucker/VimConfig/master/.vimrc
--2022-08-25 17:23:30-- https://raw.githubusercontent.com/aucker/VimConfig/master/.vimrc
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 0.0.0.0, ::
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|0.0.0.0|:443... failed: Connection refused.
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|::|:443... failed: Connection refused.
This use computer IPv4 address and clash port.
In clash, enable the ALLOW LAN
.
Add the following line to /etc/hosts
185.199.108.133 raw.githubusercontent.com