LoginSignup
6
2

More than 5 years have passed since last update.

[Git] `Auto packing the repository in background for optimum performance` `failed to run repack`

Posted at

Git Error

開発中にローカルでgit pull origin branch名を実行すると突然以下のエラーが。(Github使ってます。)

Auto packing the repository in background for optimum performance
fatal: bad object refs/remotes/origin/HEAD
error: failed to run repack

調べてみると、git fetch する度に"Auto packing the repository in background for optimum performance." が出るが出てきましたので、参考にさせていただきました。

具体的には、

git fsck

で、ポイントされていない全てのオブジェクトを表示できるそうです。
大量にありました笑
その無駄なオブジェクトを消せば、メモリ効率よくなるよね。という話です。
その後、合わせワザで

git gc --prune=now

で手動GCを行います。(Gitはauto gcというコマンドを定期的に実行)

それでもbad object refs/remotes/origin/HEAD

こういうバグが出たときって大体、ググるベースで適当に解決しようとしても直らないですよね。
純粋にバグに向き合ってみました。
普通に bad objectって書いてるので、refs/remotes/origin/HEAD
見てみました。

普通に指定されてるブランチ違うがな!!

なんで勝手に変わったんや。
と思いつつ、それを正しい数値に直して、問題は収束しました。

参考

git fetch する度に"Auto packing the repository in background for optimum performance." が出る
9.7 Gitの内側 - メインテナンスとデータリカバリ

6
2
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
6
2