187 字
1 分钟
常用代理配置

Windows CMD#

Terminal window
set http_proxy=http://yourProxyServer:port
set https_proxy=http://yourProxyServer:port

Linux / Mac#

Terminal window
# 设置代理
export http_proxy=http://yourProxyServer:port
export https_proxy=http://yourProxyServer:port
# 取消代理
unset http_proxy
unset https_proxy

Git#

Terminal window
# 设置代理
git config --global http.proxy http://yourProxyServer:port
# 查看代理
git config --global --get http.proxy
# 删除代理
git config --global --unset http.proxy

npm#

Terminal window
# 设置镜像
npm config set registry https://registry.npm.taobao.org
# 设置代理
npm config set proxy http://yourProxyServer:port
npm config set https-proxy http://yourProxyServer:port
# 取消代理
npm config rm proxy

yarn#

Terminal window
yarn config set registry https://registry.npm.taobao.org
yarn config set proxy http://yourProxyServer:port

nvm#

Terminal window
nvm proxy "http://yourProxyServer:port"

Bower (.bowerrc)#

{
"directory": "bower_components",
"proxy": "http://yourProxyServer:port/",
"https-proxy": "http://yourProxyServer:port/"
}

Gradle (gradle.properties)#

systemProp.http.proxyHost=yourProxyServer
systemProp.http.proxyPort=yourPort
systemProp.https.proxyHost=yourProxyServer
systemProp.https.proxyPort=yourPort

Python pip#

Terminal window
# 方式一:命令参数
pip install yourPackage --proxy http://yourProxyServer:port
# 方式二:配置文件 pip.ini
[install]
proxy=http://yourProxyServer:port

VSCode#

"http.proxy": "http://yourProxyServer:port"

Sublime#

"http_proxy": "http://yourProxyServer:port",
"https_proxy": "http://yourProxyServer:port"

wget#

.wgetrc
# 临时
wget url -e http-proxy=yourProxyServer:port
http-proxy = yourProxyServer:port

curl#

Terminal window
# 临时
curl url -x yourProxyServer:port
# 永久:_curlrc (Windows) 或 .curlrc (Linux)
proxy = yourProxyServer:port

Golang go get#

需设置系统变量 http_proxy 以及 Git 代理 git config --global http.proxy ...

常用代理配置
https://210214.xyz/posts/proxy-config/
作者
leileigwl
发布于
2023-01-12
许可协议
CC BY-NC-SA 4.0