Skip to main content

代理设置

Linux

note dont' use cat > ~/.bash_pofile , that is to override


cat >> ~/.bash_profile << EOF
function proxy_on() {
export http_proxy=http://127.0.0.1:7890
export https_proxy=http://127.0.0.1:7890
echo -e "终端代理已开启。"
}

function proxy_off(){
unset http_proxy https_proxy
echo -e "终端代理已关闭。"
}
EOF

source ~/.bash_profile

proxy_on
proxy_off

Windows Terminal

set http_proxy=http://127.0.0.1:7890
set https_proxy=http://127.0.0.1:7890

set http_proxy=
set https_proxy=

NPM

# 设置

npm config set proxy http://127.0.0.1:7890
npm config set https-proxy http://127.0.0.1:7890

# 恢复
npm config delete proxy
npm config delete https-proxy


git配置

可以将git的配置信息保存在.gitconfig配置文件中

[user]
name = Arterning
email = china_ningning@outlook.com
[http]
proxy = http://127.0.0.1:10809
[https]
proxy = http://127.0.0.1:10809
# 设置
git config --global http.proxy 'socks5://127.0.0.1:7890'
git config --global https.proxy 'socks5://127.0.0.1:7890'

# 恢复
git config --global --unset http.proxy
git config --global --unset https.proxy


git config --list

# test
ssh -T git@github.com