LoginSignup
25
12

More than 3 years have passed since last update.

Homebrew >=2.6.1 で brew update に失敗したメモ(GitHub からの shallow clone 禁止)

Last updated at Posted at 2020-12-16

環境

  • macOS Catalina 10.15.7
  • Homebrew 2.6.2

何が起きたか

brew update しようとしたら以下のエラーが出ました。

% brew upgrade
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!

原因と解消方法

GitHub から Homebrew に shallow clone を控えるように リクエストがあったようです。
そのため、full clone する設定が必要なように Homebrew が対応しました。

Also, as mentioned in Homebrew/brew#9383, this change was made due to a direct request from GitHub to reduce our shallow clone usage.

エラーメッセージに書かれている通りに、以下のコマンドを実行。
自分の場合、homebrew-core を解決した後に homebrew-cask でも同じことで怒られたのでそちらも対応しました。

# homebrew-core
git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" fetch --unshallow

# homebrew-cask
git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask" fetch --unshallow

参考リンク

この事象についてのディスカッション
https://github.com/Homebrew/discussions/discussions/226
この対応が入った PR
https://github.com/Homebrew/brew/pull/9383

25
12
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
25
12