Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when trying to brew update

Tags:

macos

homebrew

error: The last gc run reported the following. Please correct the root cause and remove .git/gc.log. Automatic cleanup will not be performed until the file is removed.

warning: There are too many unreachable loose objects; run 'git prune' to remove them.

brew works fine, he only show this error when i update him

like image 829
Screed Avatar asked Jan 18 '16 16:01

Screed


People also ask

Does Homebrew work on M1 Mac?

Now, on your new M1 Mac, you can install Homebrew with /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" . After the install is complete you'll see a message similar to the one below. Remember, Homebrew is now going to install packages in /op/homebrew/bin .


2 Answers

You can fix this issue by running two commands:

cd "$(brew --repo)" # Navigate to Homebrew's git repository git prune && git gc # Remove loose objects 

To check :

cd - # Go back to the original location brew update 

Output:

Already up-to-date.

Error should be fixed and gone! :)

like image 71
Mora Avatar answered Sep 28 '22 09:09

Mora


If you run %> locate gc.log you will likely see something along the lines of this in the output:

/usr/local/Library/Taps/caskroom/homebrew-versions/.git/gc.log 

In this case, to fix the problem, I went to /usr/local/Library/Taps/caskroom and ran

%> git prune

%> rm /usr/local/Library/Taps/caskroom/homebrew-versions/.git/gc.log

and the problem went away.

like image 37
Jeremy Gailor Avatar answered Sep 28 '22 09:09

Jeremy Gailor