git 报错 ` bad object refs/remotes/origin/HEAD`


git 报错

 bad object refs/remotes/origin/HEAD

How to handle git gc fatal: bad object refs/remotes/origin/HEAD error: failed to run repack
I randomly hit list today while trying to garbage collect.

$ git gc

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

How do I deal with this?

https://stackoverflow.com/a/38192799/3782855
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.

问题原因应该是,添加了新的remote,但是没有git for windows没有移除后台的origin?

Git