本文介绍了如何为 git、npm、yarn 设置代理。
添加代理
git
1 2
| git config --global http.proxy 'http://127.0.0.1:10809' git config --global https.proxy 'http://127.0.0.1:10809'
|
npm
1 2 3 4 5 6 7 8
| npm config set proxy="http://127.0.0.1:10809" npm config set https-proxy="http://127.0.0.1:10809"
npm config set registry "https://registry.npmmirror.com/" npm config set registry "https://registry.npmjs.org/"
|
yarn
1 2 3 4 5 6 7
| yarn config set proxy "http://127.0.0.1:10809" yarn config set https-proxy "http://127.0.0.1:10809"
yarn config set registry "https://registry.npmmirror.com/" yarn config set registry "https://registry.npmjs.org/"
|
查看代理
git
npm
1 2
| npm config get proxy npm config get https-proxy
|
yarn
取消代理
git
1 2
| git config --global --unset http.proxy git config --global --unset https.proxy
|
npm
1 2
| npm config delete proxy npm config delete https-proxy
|
yarn
1 2
| yarn config delete proxy yarn config delete https-proxy
|