NPM Git Yarn 如何设置代理

作者: wxfeng 分类: linux,tools,运维 发布时间: 2022-08-16 18:01    阅读 1,864 次

前言
由于有时候网络的原因,会导致 npm 、git 、yarn 下载遇到各种各样的问题。而且我们正好会使用科学上网方法。那么我们就可以为 npm 、git 、yarn 设置代理。让它们通过代理的方式的得到更优的下载网络,从而解决疑难杂症。

npm

//设置
npm config set proxy http://proxy_host:port  
npm config set https-proxy http://proxy_host:port

//查看
npm config list

//取消
npm config delete proxy
npm config delete https-proxy

yarn

# 设置
# http
yarn config set proxy http://proxy_host:port  

# https
yarn config set https-proxy http://proxy_host:port 

#查看
yarn config list

#删除
yarn config delete proxy
yarn config delete https-proxy

Git

# 设置
# https
git config --global https.proxy http://proxy_host:port  

# http
git config --global http.proxy http://proxy_host:port

#查看
git config --global  --get http.proxy
git config --global  --get https.proxy

#取消
git config --global --unset http.proxy
git config --global --unset https.proxy

如果觉得我的文章对您有用,请随意赞赏。您的支持将鼓励我继续创作!

发表评论

您的电子邮箱地址不会被公开。