NPM Git Yarn 如何设置代理

前言

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

设置方法


NPM

设置方法

# http http://127.0.0.1:8081
npm config set proxy http://proxy_host:port  

# https
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

设置方法

http 代理

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

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

socks 代理

git config --global http.proxy 'socks5://proxy_host:port'
git config --global https.proxy 'socks5://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

代理某一个域名

git config --global http.https://github.com.proxy 'socks5://proxy_host:port'
git config --global https.https://github.com.proxy 'socks5://proxy_host:port'
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值