brew updateで失敗した話

IT
  • brewでソフトウェアをインストールしようとした時にbrewそのもののバージョン更新が必要になった
  • brew updateで更新ができるが、Error: homebrew-core is a shallow clone.のエラーが出て失敗
  • 環境はmacOSです
  • 対応手順と原因(推測)をmemo
    • もし似たケースの人がいたら、手助けになれば嬉しいです
  • 注意:
    • 一部推測が含まれます。内容に誤りがあったらすみません。

結論

  • 原因:shallow cloneを使用していたため、でメジャーバージョンのアップデートが失敗した
  • 対策:unshallowでメジャーアップデートをできるようにした
    • git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallowを実行
    • ディレクトリは環境によって異なる可能性があります
    • 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 command may take a few minutes to run due to the large size of the repository.
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!

メッセージの要約

  • homebrew-coreリポジトリがshallow clone(履歴が一部のみのclone)
  • brew update前に完全な履歴の取得が必要

対応

  • git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallowを実行
    • shallow cloneでcloneされたリポジトリhomebrew-coreの全てのコミット履歴の取得
  • brew updateを実行

memo

  • brew updateでshallow cloneでクローンされていたリポジトリを参照

    • shallow clone…制限がつくが、低負荷で使用できる
  • 今回はbrewのメジャーバージョンをアップデートする必要があった→shallow cloneで可能な範囲を超えていた

  • unshallowで、完全なcloneをすることで、メジャーバージョンのアップデート(大規模更新)に対応できるようにした

  • こういった作業が必要無いように普段からこまめに更新をするのが理想的かと思います(^_^;)

コメント

タイトルとURLをコピーしました