【高效】开发过程中常见配置(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

参考资料

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
为了配置pip使用国内镜像,你可以按照以下步骤进行操作: 1. 找到pip配置文件。对于Windows系统用户,打开当前用户文件夹,然后找到名为pip.ini的文件;对于Linux系统用户,打开用户目录,找到名为.pip的隐藏文件夹,里面有一个名为pip.conf的文件。 2. 打开配置文件,可以使用文本编辑器进行编辑。 3. 在配置文件添加以下内容: [global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple [install] trusted-host = https://pypi.tuna.tsinghua.edu.cn 这样就配置了清华镜像为默认。你也可以选择其他常用的国内镜像,如阿里镜像、豆瓣镜像等。 4. 保存文件并关闭编辑器。 这样,你的pip就会使用国内镜像进行下载和安装包了。配置完成后,你可以使用"pip config list"命令来验证配置是否生效。另外,如果你想临时指定使用某个镜像进行下载,可以在命令行使用"-i"参数加上镜像的地址。例如,使用清华镜像下载numpy包可以使用以下命令:"pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple"。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [pip配置国内镜像配置文件](https://download.csdn.net/download/qq_35789981/12609009)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [Python-pip镜像配置国内常用镜像](https://blog.csdn.net/guokexiaohao/article/details/126323368)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [pip国内镜像配置](https://blog.csdn.net/zhoulinshijie/article/details/87974824)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

夜猫逐梦

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

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

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

打赏作者

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

抵扣说明:

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

余额充值