Search code examples
gitoh-my-zsh

Upgrading Oh My Zsh gives me 'not a git repository' error


Since I upgrade my OSX to El Capitan when I want to update Oh My Zsh upgrade_oh_my_zsh I got the following error:

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

I never used git before, searching this fatal error on the internet they advice to do git init in the /.oh-my-zsh folder. After running this command a new fatal error occur when I try to run upgrade_oh_my_zsh again.

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. 

I don't know if it has anything to do with with it but when I open the terminal (iTerm2) I also got this notification:

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

Anyone has experience with this or knows a solution for my problem?


Solution

  • Looks like your git repo was removed from oh-my-zsh? You can re-add the remote and update to the latest version of Zsh by running:

    cd ~/.oh-my-zsh
    git init # you've already done this step, so you can skip
    git remote add origin https://github.com/ohmyzsh/ohmyzsh.git
    git fetch
    git reset --hard origin/master
    

    After that, restart your terminal instance and you should be good to go.

    enter image description here