How to handle git gc fatal: bad object refs/remotes/origin/HEAD error?

后端 未结 8 1441
庸人自扰
庸人自扰 2021-01-30 02:36

I randomly hit this today while trying to run Git garbage collect:

$ git gc
fatal: bad object refs/remotes/origin/HEAD
error: failed to run repack
         


        
8条回答
  •  说谎
    说谎 (楼主)
    2021-01-30 03:27

    The cause of this for me was working in a compressed folder in Windows. When the folder was uncompressed, it corrupted the pack files, cascading other odd issues, such as not being able to prune nonexistent branches.

    The only fix was to wipe out the working directory and clone the repo remote(s) again. Luckily, I could still push and pull updates to ensure nothing was lost. All is well now.

提交回复
热议问题