Error: homebrew-core is a shallow clone. homebrew-cask is a shallow clone.

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
These commands may take a few minutes to run due to the large size of the repositories.
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!

brew updatebrew tapをすると以下のようなエラーが出てしまいます。

このエラーの内容を日本語に訳すと以下のようになります。

リポジトリのサイズが大きいため、これらのコマンドの実行には数分かかる場合があります。
浅いクローンの更新は、Homebrew / homebrew-coreとHomebrew / homebrew-caskのツリーレイアウトとトラフィックのために非常にコストのかかる操作であるため、この制限はGitHubのリクエストで行われました。 CIシステムで高価な浅くない操作を繰り返し実行することを避けるために、これを自動的に行うことはありません(代わりに浅いクローンを使用しないように修正する必要があります)。 ご不便おかけしてすみません!

homebrew-corehomebrew-caskが原因になってでエラーが出ています。

今回はこのエラーが出たときの解決方法と原因をご紹介します。

目次

解決策はエラー文中に出ているコマンドを実行

解決策はエラー文中に出ているコマンドを実行することです。

以下の2つのコマンドを実行してください。
エラーが解消されます。

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

原因はHomebrewの仕様変更

2020年12月以降にこのようなエラーが出ています。

HomebrewはこれまでGitリポジトリのshallow cloneを利用していましたが、これからはcloneを利用して更新するように仕様変更になったからです。

brew update refuses to update shallow homebrew-core/cask clones (on request from GitHub).

https://brew.sh/2020/12/21/homebrew-2.7.0/

なぜこのような仕様変更になったのかは、以下のディスカッションを参照してください。
Why is a full clone of homebrew/core required for brew update?

2020年12月4日の時点で該当がプルリクがマージされています。
update.sh: refuse to update shallow homebrew-core/cask clones.

まとめ

Homebrewで以下のエラーが出るのは、cloneを利用して更新するように仕様変更になったからです。

Error: 
  homebrew-core is a shallow clone.
  homebrew-cask is a shallow clone.

以下のコマンドを実行して更新エラーを解消しましょう。

git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow
よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!

コメント

コメントする


The reCAPTCHA verification period has expired. Please reload the page.

目次