[小ネタ]brew updateがhomebrew-core is a shallow cloneと出力して動かなくなった時の対応

久しぶりにbrew updateを実行したら、以下のように「homebrew-core is a shallow clone」「homebrew-cask is a shallow clone」というエラーが出て動かなくなっていました。

$ brew update
Error:
 homebrew-core is a shallow clone.
 homebrew-cask is a shallow clone.
To `brew update`, first run:
 git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
 git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow
This restriction has been made on GitHub's request because updating shallow
clones is an extremely expensive operation due to the tree layout and traffic of
Homebrew/homebrew-core and Homebrew/homebrew-cask. We don't do this for you
automatically to avoid repeatedly performing an expensive unshallow operation in
CI systems (which should instead be fixed to not use shallow clones). Sorry for
the inconvenience!
$

こうした場合は、メッセージに書かれている通りのgitコマンドを実行すると治ります。

$ git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
(メッセージがいろいろ出力される)
$
$ git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow
(メッセージがいろいろ出力される)
$

参考情報

[brew update]Error:homebrew-core is a shallow clone.で失敗するのを解決

この記事が気に入ったらサポートをしてみませんか?