本文记录工作中用到的软件的代理或镜像配置方式。
Git
1 2 3 4 5 6
| # 配置代理 git config --global http.proxy http://127.0.0.1:1080 git config --global https.proxy https://127.0.0.1:1080 # 删除代理 git config --global --unset http.proxy git config --global --unset https.proxy
|
Node
NPM设置代理:
1 2
| npm config set proxy="<http_proxy>" npm config set https-proxy="<https_proxy>"
|
NPM删除代理:
1 2
| npm config delete proxy npm config delete https-proxy
|
YARN设置代理:
1 2
| yarn config set proxy <http_proxy> yarn config set https-proxy <https_proxy>
|
YARN删除代理:
1 2
| yarn config delete proxy yarn config delete https-proxy
|
设置registry:
1 2 3 4 5
| npm config set registry https://registry.npm.taobao.org/ npm config set registry https://registry.npmjs.org/
yarn config set registry https://registry.npm.taobao.org/ yarn config set registry https://registry.npmjs.org/
|
若安装包时,包名是 git:// 协议,可以通过
git config --global url."https://".insteadOf git://
将 git
协议转为 https 协议。