Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

oh-my-zsh

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?

like image 210
Peter Avatar asked Nov 02 '15 20:11

Peter


People also ask

Why does it say not a git repository?

The “not a git repository” error is common. The cause is running a Git command in the wrong folder or running a Git command before initializing a Git repository. Now you're ready to solve the “not a git repository” error like an expert developer!

How do I fix a non repository in git?

To do so, you need to navigate to the correct folder and then run the command git init , which will create a new empty Git repository or reinitialize an existing one.

Does git work with zsh?

git-prompt.sh is compatible with both Bash and Zsh. Zsh is powerful enough that there are entire frameworks dedicated to making it better.

How do I upgrade my oh my zsh?

To manually update ohmyzsh, you can run the "omz" update command and just like that you will get the latest version of ohmyzsh.


1 Answers

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/robbyrussell/oh-my-zsh.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

like image 112
Travis Avatar answered Sep 17 '22 17:09

Travis