升级Oh My Zsh给了我';不是git存储库';错误

升级Oh My Zsh给了我';不是git存储库';错误,git,oh-my-zsh,Git,Oh My Zsh,当我想更新Oh my Zshupgrade_Oh_my_Zsh时,我将OSX升级到El Capitan,因此出现以下错误: Upgrading Oh My Zsh fatal: Not a git repository (or any of the parent directories): .git There was an error updating. Try again later? 我以前从未使用过git,在internet上搜索这个致命错误,他们建议在/.oh my zsh文件夹中执

当我想更新Oh my Zsh
upgrade_Oh_my_Zsh
时,我将OSX升级到El Capitan,因此出现以下错误:

Upgrading Oh My Zsh
fatal: Not a git repository (or any of the parent directories): .git
There was an error updating. Try again later?
我以前从未使用过git,在internet上搜索这个致命错误,他们建议在
/.oh my zsh
文件夹中执行
git init
。运行此命令后,当我再次尝试运行
upgrade\u oh\u my\u zsh
时,会出现一个新的致命错误

fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists. 
我不知道这是否与此有关,但当我打开终端(iTerm2)时,我也收到了以下通知:

/Users/peter/.zshrc:1: command not found: Path

有人对此有经验或知道我的问题的解决方案吗

看来你的git回购协议已经从oh my zsh中删除了?您可以通过运行以下命令重新添加远程并更新至最新版本的Zsh:

cd ~/.oh-my-zsh
git init # you've already done this step, so you can skip
git remote add origin https://github.com/robbyrussell/oh-my-zsh.git
git fetch
git reset --hard origin/master
之后,重新启动终端实例,就可以开始了


上述解决方案对我不起作用。 我的问题是我有一个别名

alias gpucb=“git pull origin$(git branch--show current)”

我一发表评论,错误就消失了。 我需要解决这个问题。
另外,奇怪的是,只有在第二个
git
命令中才会遇到错误。

谢谢,这是有效的!就在我执行最后一步时,我必须先删除
--硬
,然后再使用
--硬
执行一次,但没有效果。当我打开一个新的终端窗口时,仍然会出现错误您的问题是命令
$(git branch--show current)
是在别名求值时执行的。要解决这个问题,您可以使用“\”来转义
$
,或者使用单引号来包装别名,这似乎也很有效。