After a git annex copy --auto -t m3
I got this error:
(Recording state in git...)
error: unable to resolve reference refs/heads/git-annex: No such file or directory
fatal: Cannot lock the ref 'refs/heads/git-annex'.
git-annex: git [Param "update-ref",Param "refs/heads/git-annex",Param "d768b20f76ce40157214a713fb0ccb9cfc9134c2"] failed
I did a git annex sync m3
and got
[...]
push m3
Counting objects: 2976, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2052/2052), done.
Writing objects: 100% (2379/2379), 392.33 KiB, done.
Total 2379 (delta 1652), reused 460 (delta 316)
Auto packing the repository for optimum performance.
error: bad ref for refs/heads/git-annex
error: bad ref for refs/heads/git-annex
error: bad ref for refs/heads/git-annex
To /media/m3/annex
87c82c5..06219eb git-annex -> synced/git-annex
be7ff5e..6625634 master -> synced/master
ok
And then I ran the command git-annex was trying to run:
$ git update-ref refs/heads/git-annex d768b20f76ce40157214a713fb0ccb9cfc9134c2
error: Trying to write ref refs/heads/git-annex with nonexistent object d768b20f76ce40157214a713fb0ccb9cfc9134c2
fatal: Cannot update the ref 'refs/heads/git-annex'.
git fsck --full
gives no errors.
What does this error mean? Should I be worried? Thanks.
I'm afraid that this looks like a partially corrupted git repository to me. Something seems to have gone wrong with
.git/refs/heads/git-annex
. Also, git object d768b20f76ce40157214a713fb0ccb9cfc9134c2 seems to have been present before, and be gone now.I would run
git fsck
, then look at what's happened in.git/refs/heads
, and if the repository does seem to be damanged, re-clone it. (You can copy over.git/config
and.git/annex/
to keep your annexed data in the new clone.) You should probably also rungit annex fsck
, as it could have lost some location log changes.Thanks for taking the time to reply.
1) The corruption spread between repositories so I resorted to restoring from a backup from some days ago, and then I restored newly added files by manually copying the symlinks from the old repo into the new one. Of course I can't update the git-annex branch by hand. I've run
git annex fsck
: does that re-create the location log information for the symlinks that I re-added, at least for the local repository even if it doesn't know about copies elsewhere?2) I initially tried to git clone from my restored backup, rather than just moving the restore into place. But then while this clone showed no errors on a
git fsck --full
, any git-annex command, such asinit
(following this), gives the following sort of error:(unfortunately I lost my xterm so don't have one of my actual errors in full). Can you think of any reason why doing a clone of the backup copy would cause this? Instead I have just mv'd the backup copy into place and it works fine.
I don't understand how corruption could spread between git repositories. git is supposed to use checksums to prevent bad data propigating. I would be running a lot of
git fsck
if I were you. Yes,git annex fsck
will update location log information for files it finds in the local repository.Again this looks like something is corrupting your repository when git writes it. Perhaps bad memory? I think you need to get to the root of the problem with the corrupting git repositories.
I didn't think that git would let corruption spread either, but it did: the repository m3 which I showed a push to in my original post showed a broken refs/heads/git-annex too. You can see it happening when git tries to repack m3 after pushing to it in my original post.
I am pretty sure that my HDD on the machine where this first occurred needs replacing; I've marked the remote as untrusted.