升级哦我的Zsh给了我'不是git存储库'的错误

Pet*_*ter 9 git oh-my-zsh

因为我想要更新我的OSX到El Capitan哦我的Zsh upgrade_oh_my_zsh我得到以下错误:

Upgrading Oh My Zsh
fatal: Not a git repository (or any of the parent directories): .git
There was an error updating. Try again later?
Run Code Online (Sandbox Code Playgroud)

我从来没有使用过git,在互联网上搜索这个致命的错误,他们建议git init/.oh-my-zsh文件夹中做.运行此命令后,当我upgrade_oh_my_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. 
Run Code Online (Sandbox Code Playgroud)

我不知道它是否与它有任何关系但是当我打开终端(iTerm2)时我也收到了这个通知:

/Users/peter/.zshrc:1: command not found: Path
Run Code Online (Sandbox Code Playgroud)

任何人都有这方面的经验或知道我的问题的解决方案?

n__*_*__o 19

我刚刚遇到了那个消息。就我而言(在 Mac 上),碰巧我刚刚安装了 Xcode,并且 git 停止工作,直到我接受其条款和条件。万一...

  • 我也遇到同样的情况。当我运行“omz update”时,系统指示我运行“sudo xcodebuild -license”,因为我最近安装了 Xcode。运行命令解决了该问题。 (2认同)

Tra*_*vis 14

看起来你的git repo已经从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
Run Code Online (Sandbox Code Playgroud)

之后,重新启动终端实例,你应该好好去.

在此输入图像描述

  • 没用。当我打开新的终端窗口时,我仍然收到错误 (2认同)
  • @travis 您能否更新说明并使用“https://github.com/ohmyzsh/ohmyzsh”代替? (2认同)

小智 8

对我来说,错误的根本原因是升级到 macOS Ventura。执行xcode-select --install并重新启动终端解决了该问题。


Aas*_*thi 7

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

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

As soon as I commented it the error was gone. I need a fix for this. Also, the weird part is that the error is encountered only in the second git command.

  • 您的问题是在评估别名时执行命令“$(gitbranch --show-current)”。为了解决这个问题,你可以使用“\\”来转义“$” (7认同)
  • 或者使用单引号来包裹别名,这似乎也可行。 (5认同)