Search code examples
gitversion-controlgarbage-collectionsourcetree

git gc - fatal: bad object refs/remotes/Icon


My git gc is giving me errors:

error: bad ref for Icon
fatal: bad object refs/remotes/Icon
error: failed to run repack

I know those Icon files are connected with OS X's auto-created files. I have added them to .gitignore.

But they could have been committed before I did this.

I am the only one who commits / has copy to the repository.

Thank you.


Solution

  • Solved it.

    Apparently OS X just created those files in ref folder and git was looking for them.

    So I have used a command to find and recursively delete all Icon files:

    find . -name "Icon?" -print0 | xargs -0 rm -rf
    

    Source: Recursively Remove Icon? in Mac OSX.sh