brew update できない (error: The last gc run reported the following. Please correct the root cause and remove .git/gc.log.)
brew update
しようと思ったらエラーとなってしまった。
% brew update Updating Homebrew... Auto packing the repository in background for optimum performance. See "git help gc" for manual housekeeping. 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.
どうやらゴミを溜め込みすぎてしまったらしいのでガベージコレクトしてやれば良さそう。
しかし .git/gc.log.
とは一体どの場所のことを言っているのだろうか。
ひとまず頻繁に使用しているリポジトリから git gc
, git prune
を使ってお掃除することにした。
% git gc (git)-[master] Counting objects: 220332, done. Delta compression using up to 4 threads. Compressing objects: 100% (50809/50809), done. Writing objects: 100% (220332/220332), done. Total 220332 (delta 167795), reused 219889 (delta 167392) Checking connectivity: 220332, done. % git prune (git)-[master] Checking connectivity: 220332, done.
しかし、効果はなかった ... 。
homebrew 自体を少しだけ疑ってみる。
% brew doctor (git)-[master] Your system is ready to brew. % brew cleanup
特に異常なし。
エラーでググってみる。
なるほどぉ。
しかし
.git/gc.log.
とは一体どの場所のことを言っているのだろうか。
ここだったようです 💁
% ls /usr/local/Homebrew/.git/gc.log /usr/local/Homebrew/.git/gc.log
% cd "$(brew --repo)" % pwd /usr/local/Homebrew % git prune && git gc (git)-[stable] Counting objects: 71967, done. Delta compression using up to 4 threads. Compressing objects: 100% (19701/19701), done. Writing objects: 100% (71967/71967), done. Total 71967 (delta 51484), reused 70860 (delta 50377)
% brew update hoge hoge 🍺 Already up-to-date.
年末の大掃除っぽいこともしつつ学びがありました 📝 (というのを先輩エンジニアとやってました)