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
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 .
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! :)
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With