常用终端代理配置
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
本文作者:TomZz
本文链接:https://www.cnblogs.com/Tom-Zz/p/16503799.html
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步