常用终端代理配置
Windows
全局设置
设置->系统->高级系统设置->环境变量
系统环境变量
HTTP_PROXY: http://127.0.0.1:7890
HTTPS_PROXY: http://127.0.0.1:7890
Powershell
notepad $profile
function proxy() {
$Env:https_proxy="http://localhost:port"
$Env:http_proxy="http://localhost:port"
}
function noproxy() {
$Env:https_proxy=""
$Env:http_proxy=""
}
CMD
设置
set http_proxy=ip:port
set https_proxy=ip:port
清除
set http_proxy=
set https_proxy=
Bash Zsh等
vim ~/.bashrc or vim ~/.zshrc
export http_proxy=http://127.0.0.1:7890
export https_proxy=http://127.0.0.1:7890
proxy () {
export http_proxy="http://127.0.0.1:7890"
export https_proxy="http://127.0.0.1:7890"
echo "Network Proxy on"
}
noproxy () {
unset http_proxy
unset https_proxy
echo "Network Proxy off"
}
Fish
vim ~/.config/fish/config.fish
function proxy
set -xg ALL_PROXY http://localhost:1087
end
function noproxy
set -e ALL_PROXY
end
proxy
Git
git config --global http.proxy http://127.0.0.1:7890
git config --global https.proxy http://127.0.0.1:7890
git config --global --unset http.proxy
git config --global --unset https.proxy
NPM
npm config set proxy http://username:password@server:port
npm config set https-proxy http://username:pawword@server:port
使用CNPM
npm init
npm install -g cnpm --registry=https://registry.npmmirror.com
Go
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
go install golang.org/x/tools/gopls@latest