一、从国内镜像下载安装脚本
curl -O https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh
二、修改安装脚本并安装
找到以下部分
# Default settings
ZSH=${ZSH:-~/.oh-my-zsh}
REPO=${REPO:-ohmyzsh/ohmyzsh}
REMOTE=${REMOTE:-https://github.com/${REPO}.git}
BRANCH=${BRANCH:-master}
把
REPO=${REPO:-ohmyzsh/ohmyzsh}
REMOTE=${REMOTE:-https://github.com/${REPO}.git}
替换为
REPO=${REPO:-mirrors/oh-my-zsh}
REMOTE=${REMOTE:-https://gitee.com/${REPO}.git}
编辑后保存。
执行
bash install.sh
开始安装。
三、配置从国内镜像更新
执行以下命令
cd ~/.oh-my-zsh
git remote set-url origin https://gitee.com/mirrors/oh-my-zsh.git
git pull
后续即可从国内镜像更新。
参考:
https://catch6.github.io/2021/01/20/oh-my-zsh-china-mirrors-install-and-update.html