git配置代理

http/https代理

  • 设置
git config --global http.proxy http://127.0.0.1:7890
git config --global https.proxy https://127.0.0.1:7890
  • 查看
git config --global http.proxy
git config --global https.proxy
  • 删除
git config --global --unset http.proxy
git config --global --unset https.proxy

socks5代理

  • 设置
git config --global http.proxy # socks5://127.0.0.1:7890
git config --global https.proxy # socks5://127.0.0.1:7890

查看与删除与http/https代理相同

npm配置代理

  • 设置
npm config set proxy http://127.0.0.1:7890
npm config set https-proxy http://127.0.0.1:7890
  • 删除
npm config delete proxy
npm config delete https-proxy
  • 查看
npm config list

yarn配置代理

  • 设置
yarn config set proxy http://127.0.0.1:7890
yarn config set https-proxy http://127.0.0.1:7890
  • 删除
yarn config delete proxy
yarn config delete https-proxy
  • 查看
yarn config list

npm切换源

npm config set registry http://registry.npm.taobao.org/ (淘宝源)
npm config set registry https://registry.npmjs.org/ (官方源)

yarn切换源

yarn config set registry http://registry.npm.taobao.org/ (淘宝源)
yarn config set registry https://registry.npmjs.org/ (官方源)
最后修改:2023 年 08 月 01 日
如果觉得我的文章对你有用,请随意赞赏