由於安裝oh-my-zsh需要在github上拉取repo,所以國內網絡環境安裝可能有些困難,然后就看到了一個教程,使用gitee鏡像,但步驟比較多,所以我簡化了一下
部分內容轉載來自:oh-my-zsh國內鏡像安裝
直接復制執行
sh -c "$(curl -fsSL https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh \
| sed 's|^REPO=.*|REPO=${REPO:-mirrors/oh-my-zsh}|g' \
| sed 's|^REMOTE=.*|REMOTE=${REMOTE:-https://gitee.com/${REPO}.git}|g')"
我常用的PS1
# zsh PS1
export PS1='%(?:%{$fg_bold[green]%}%n@%m:%{$fg_bold[red]%}%n@%m) %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
以下是轉載內容:
首先下載 gitee 鏡像的安裝腳本
wget 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}
保存后直接運行安裝腳本
接下來修改倉庫地址,這一步是為了更新檢查正常
cd ~/.oh-my-zsh
git remote set-url origin https://gitee.com/mirrors/oh-my-zsh.git
git pull