0%

包管理器镜像源配置

本篇主要记录各软件、包管理器使用时因GWF无法使用而需修改国内代码源的解决方案:

Composer.

composer config -g repo.packagist composer https://packagist.phpcomposer.com

Brew.

替换brew.git:
cd “$(brew –repo)”
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

替换homebrew-core.git:
cd “$(brew –repo)/Library/Taps/homebrew/homebrew-core”
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

替换Homebrew Bottles源:
echo ‘export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc

brew update

切换回官方源
重置brew.git:
cd “$(brew –repo)”
git remote set-url origin https://github.com/Homebrew/brew.git

重置homebrew-core.git:
cd “$(brew –repo)/Library/Taps/homebrew/homebrew-core”
git remote set-url origin https://github.com/Homebrew/homebrew-core.git

注释掉bash配置文件里的有关Homebrew Bottles即可恢复官方源。 重启bash或让bash重读配置文件

npm.

https://npm.taobao.org/
npm install -g cnpm –registry=https://registry.npmmirror.com

pip.

vi ~/.pip/pip.conf
[global]
trusted-host = mirrors.aliyun.com
index-url = http://mirrors.aliyun.com/pypi/simple