【高效】开发过程中常见配置(pip、npm、maven、git等各种国内源)

nvm

打开nvm安装目录,找到settings.txt文件,在最后添加一下参数

node_mirror:https://npm.taobao.org/mirrors/node/
npm_mirror: https://npm.taobao.org/mirrors/npm/

pip

linux
位置:~/.pip/pip.conf

windows
位置: %HOMEPATH%\pip\pip.ini

[global]
trusted-host =  mirrors.aliyun.com
index-url = https://mirrors.aliyun.com/pypi/simple

npm

配置taobao镜像

windows
位置: %HOMEPATH%\.npmrc

npm config set registry https://registry.npm.taobao.org --global
npm config set disturl https://npm.taobao.org/dist --global
npm config set ELECTRON_MIRROR http://npm.taobao.org/mirrors/electron/ --global
npm config set CHROMEDRIVER_CDNURL https://npm.taobao.org/mirrors/chromedriver --global
npm config set ELECTRON_BUILDER_BINARIES_MIRROR https://npm.taobao.org/mirrors/electron-builder-binaries/ --global

npm install electron@16.0.7

node 16.16.0 中报如下警告:
《npm WARN config global --global, --local are deprecated. Use --location=global instead.`
–location=global》
所以修改配置如下:

npm config set registry https://registry.npm.taobao.org --location=global
npm config set disturl https://npm.taobao.org/dist --location=global
npm config set ELECTRON_MIRROR http://npm.taobao.org/mirrors/electron/ --location=global
npm config set CHROMEDRIVER_CDNURL https://npm.taobao.org/mirrors/chromedriver --location=global
npm config set ELECTRON_BUILDER_BINARIES_MIRROR https://npm.taobao.org/mirrors/electron-builder-binaries/ --location=global

解决fatal: unable to connect to git://github.com问题

git config --global url."https://".insteadOf git://

解决fatal: unable to connect to github.com问题

# 设置代理
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'


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

maven

windows
位置: %HOMEPATH%\.m2\settings.xml

  <mirrors>
	<mirror>
        <id>alimaven</id>
        <mirrorOf>central</mirrorOf>
        <name>aliyun maven</name>
             <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    </mirror>
  </mirrors>

git

设置git账号和密码

  • 避免每次换机器得配置各种账号密码
  • 可以一次性配置多个服务器
  • 【缺点】:安全性差

windows
位置: %HOMEPATH%\_netrc

设置git全局信息

git config --global credential.helper store

git config --global user.email "你的邮箱"

git config --global user.name "你的github用户名"
machine gitee.com
login kinghzking****
password 123456789Kkk

machine github.com
login kinghzking****
password 123456789Kkk

在这里插入图片描述

electron

npm config set registry https://registry.npm.taobao.org
npm config set ELECTRON_MIRROR http://npm.taobao.org/mirrors/electron/
npm config set CHROMEDRIVER_CDNURL https://npm.taobao.org/mirrors/chromedriver
npm config set ELECTRON_BUILDER_BINARIES_MIRROR https://npm.taobao.org/mirrors/electron-builder-binaries/

npm install electron@16.0.7

github

github 镜像站

  • gitclone.com
  • https://hub.fastgit.xyz​​
  • https://hub.fastgit.org
  • github.do
  • ghproxy.com
  • hub.0z.gs
git clone https://hub.fastgit.xyz/ossrs/srs-gb28181.git


# 查看设置列表
git config --global --list


# 设置config
git config --global url."https://hub.fastgit.xyz/".insteadOf "https://github.com/"
git config --global url."https://".insteadOf "git://"
git config protocol.https.allow always

# 取消设置
git config --global --unset url."https://hub.fastgit.xyz​​/".insteadOf 

brew

替换为阿里源

# 查看 brew.git 当前源
$ cd "$(brew --repo)" && git remote -v
origin    https://github.com/Homebrew/brew.git (fetch)
origin    https://github.com/Homebrew/brew.git (push)

# 查看 homebrew-core.git 当前源
$ cd "$(brew --repo homebrew/core)" && git remote -v
origin    https://github.com/Homebrew/homebrew-core.git (fetch)
origin    https://github.com/Homebrew/homebrew-core.git (push)

# 修改 brew.git 为阿里源
$ git -C "$(brew --repo)" remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git

# 修改 homebrew-core.git 为阿里源
$ git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git

# zsh 替换 brew bintray 镜像
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc
$ source ~/.zshrc

# bash 替换 brew bintray 镜像
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile
$ source ~/.bash_profile

# 刷新源
$ brew update

参考资料

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

夜猫逐梦

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值