npm、yarn、git设置代理


npm 设置代理

无密码的:

1
2
$ npm config set proxy http://server:port
$ npm config set https-proxy http://server:port

有密码的

1
2
$ npm config set proxy http://username:password@server:port
$ npm config set https-proxy http://username:pawword@server:port
1
2
3
删除代理
npm config rm proxy
npm config rm https-proxy

yarn 设置代理

设置代理 :

1
2
yarn config set proxy <http_proxy>
yarn config set https-proxy <https_proxy>

删除代理 :

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 设置代理

设置代理:

1
2
git config --global http.proxy http://127.0.0.1:xxxx
git config --global https.proxy https://127.0.0.1:xxxx

删除代理:

1
2
git config --global --unset http.proxy
git config --global --unset https.proxy