Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

homebrew cannot update and I cannot add a git repository

Tags:

homebrew

Pretty much what the title says. I'm trying to update homebrew using

brew update

and I always get the error message

$ brew update
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
Error: Failure while executing: git checkout -q master

The brew doctor command output is as follows:

$ brew doctor
Warning: Missing git origin remote.

Without a correctly configured origin, Homebrew won't update
properly. You can solve this by adding the Homebrew remote:
  cd /usr/local
  git remote add origin https://github.com/Homebrew/homebrew.git
fatal: Not a git repository (or any of the parent directories): .git

When I run

cd /usr/local
git remote add origin https://github.com/Homebrew/homebrew.git

I get

$ cd /usr/local
$ git remote add origin https://github.com/Homebrew/homebrew.git
fatal: Not a git repository (or any of the parent directories): .git

What can I do to get rid of this problem? It seems git doesn't recognize homebrew's repository, put what should I use instead of this suggested one?

like image 204
Marcus Nunes Avatar asked Jan 21 '14 19:01

Marcus Nunes


People also ask

Does not appear to be a git repository git pull?

The “… does not a appear to be a git repository” error is triggered when you try to clone, or run other commands, in a directory that is not recognized as a Git repository. The directory or remote file path might not have initialized Git, or the file path you are trying to access as an active repository is incorrect.


2 Answers

Indeed a correct answer but no need to go so far.

As mentioned in the comments also, removing the top .git directory present in /usr/local is enough. Run your brew update after only having removed the top .git directory will rebuild the tree!

Segmentation fault: 11 with your PHP installation is same issue it is still the pulled version from the Mavericks bottle so update and upgrade will correct this and also only needed for your main php55 or php56 and not for all your PHP dependencies installed using Homebrew.

GL!!!

like image 75
Bojoer Avatar answered Oct 18 '22 19:10

Bojoer


I had the same problem, simply cloned the homebrew repository in a temporary location using

git clone https://github.com/Homebrew/homebrew.git

and moved the resulting .git directory to /usr/local, overwriting the one already there. After that, I had to checkout a few directories:

cd /usr/local
git checkout Library/Formula/
git checkout Library/Contributions/
git checkout Library/ENV/
git checkout Library/Homebrew/
like image 27
janlugt Avatar answered Oct 18 '22 20:10

janlugt