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

后端 未结 8 1438
庸人自扰
庸人自扰 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:29

    I don't understand the ramifications of this, but as suggested in this thread, when I encountered this I just did

    $ mv .git/refs/remotes/origin/HEAD /tmp
    

    (keeping it around just in case) and then

    $ git gc
    

    worked without complaining; I haven't run into any problems.

提交回复
热议问题