git-annex/ tips/ what to do when you lose a repository

So you lost a thumb drive containing a git-annex repository. Or a hard drive died or some other misfortune has befallen your data.

Unless you configured backups, git-annex can't get your data back. But it can help you deal with the loss.

Go somewhere that knows about the lost repository, and mark it as dead:

    git annex dead usbdrive

This retains the location tracking information for the repository, but avoids trying to access it, or list it as a location where files are present.

If you later found the drive, you could let git-annex know it's found like so:

    git annex semitrust usbdrive

comment 9

Both `git annex sync` and `git pull` will still try to access the git remote for the repository. Thing to do to prevent this is `git remote remove` it.

I think it makes sense for `git annex sync` to still try to push/pull from a dead remote, since git pull/push will still try to access it too. Marking the remote dead does prevent other git-annex commands from trying to use it for data storage.

Comment by joey — Wed Oct 29 14:05:27 2025
comment 8
I've issued `git annex dead` for a full git-annex repo (not a special remote) I had in a VPS, but my local machine keeps trying to sync with it on `git annex sync`, asking me to confirm the ssh public key and so on. Is that correct?
Comment by fiatjaf — Wed Oct 29 14:05:27 2025
still need to remove the remote after a "dead"

Hello,

I decommissioned a machine and installed git annex on another machine, with the same IP as the initial one. To avoid errors, I declared the first repository as dead and created a new one (with a new remote). However, I also had to remove the git remote to the dead machine as "git annex sync" kept telling me synchronizing to this dead machine failed (the ssh succeeded, using the name automatically generated by git annex, but the repository was not at the same path on the new machine, so it could not find it).

Should a dead repository not tried to be synchronized at all during git annex sync?

Thanks,

Alan

Comment by http://alan.petitepomme.net/ — Wed Oct 29 14:05:27 2025
comment 6
You could use `git annex forget --drop-dead` in that situation, but what I would do is first `git annex describe lostremote "my old drive that I lost"` and then set up the replacement drive with whatever description you had before.
Comment by http://joeyh.name/ — Wed Oct 29 14:05:27 2025
forget command

Unfortunately, I plugged in the drive and it was alive just long enough to clone the repo and pull down about half of the data. Then it just started clicking. I did my best to wipe the drive before I returned it, but it didn't even make it that far.

Now I've got a replacement drive. Since my system auto-mounts based on the partition label; I had been using the label to identify external drives. So I want to describe the drive the same way to my system & git-annex.

In this case, I think I'd like to completely get rid of any notion the repos have of the old drive.

Comment by https://openid.stackexchange.com/user/e65e6d0e-58ba-41de-84cc-1f2ba54cf574 — Wed Oct 29 14:05:27 2025
comment 4

I wouldn't recommend running `git annex forget --drop-dead` right after losing a drive. You might find the drive again, or get the dead drive to work again. Even if you know you'll never find it, you may want to query git-annex to find files that were only located on that drive, and deal with them, etc.

But if you're worried about that information in the git-annex branch cluttering up the git repository, you keep in mind that `git annex forget` will let you remove it at some point in the future.

Comment by http://joeyh.name/ — Wed Oct 29 14:05:27 2025
Update?
Is it reasonable to update this page to include `git-annex forget`?
Comment by https://openid.stackexchange.com/user/e65e6d0e-58ba-41de-84cc-1f2ba54cf574 — Wed Oct 29 14:05:27 2025
comment 3
`dead` is the best we can do. The automatic merging used on the git-annex branch tends to re-add lines that are deleted in one repo when merging with another that still has them.
Comment by http://joeyh.name/ — Wed Oct 29 14:05:27 2025
comment 1

Is there a way to have git-annex completely ignore a repository? I see that the `dead` command adds the uuid of the repository to `trust.log` but does not change `uuid.log`. Is it enough to remove the corresponding line in `uuid.log` and `trust.log`?

Comment by http://dlaxalde.myopenid.com/ — Wed Oct 29 14:05:27 2025
Comments on this page are closed.