August 3, 2011

git: Resolving 'git gc' error: cannot lock ref

Posted in Software at 17:37 by graham

If you get an error like this from git::

Auto packing the repository for optimum performance. You may also
run "git gc" manually. See "git help gc" for more information.
error: cannot lock ref 'HEAD (xyz's conflicted copy 2011-06-02)'
error: cannot lock ref 'refs/heads/master (xyz's conflicted copy 2011-06-02)'
error: failed to run reflog

You just need to delete the offending files from .git/logs/ and run your operation again.

1 Comment »

  1. Tommy said,

    March 5, 2013 at 05:32

    Thanks =)

    Worked like a charm.

Leave a Comment

Note: Your comment will only appear on the site once I approve it manually. This can take a day or two. Thanks for taking the time to comment.