0
0

More than 1 year has passed since last update.

brew update実行時にError: homebrew-core is a shallow clone. が出て実行できなかった時の対処法

Posted at

問題

Homebrewで
brew update
を実行しようとしたらこんなエラーが...

Error: homebrew-core is a shallow clone. To `brew update` first run:
  git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" 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. 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 -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" fetch --unshallow

を実行すればOK。
※リポジトリのパスは環境によって異なるので、上記コマンドをコピペするとうまくいきません!

原因

どうやら2020年12月以降に発生するエラーだそうで、それまでHomebrew は Git リポジトリの shallow clone を利用していたのですが、 shallow clone のアップデートはどうしても処理が重くなってしまうとのことで、 GitHub からのリクエストを受けて shallow cloneではなく、clone全体を使う形に変更になったようです。

※shallow clone: 直近のコミット(変更)のみ取得することができるGitの機能

どうして全体のクローンよりも最新の変更分だけ取得する方が処理が重いの?
と思った方は、以下の記事で分かりやすく説明されいているので是非ご覧になってください。
https://qiita.com/digitalhimiko/items/81184819f6555d4eaa75

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0