I want to use git-annex to manage some data which I keep at, say, /home/my_user/data . I have multiple external storage devices for this repo, such as /run/media/my_user/data1 e
BUT, I also have multiple machines, e.g. my desktop and my laptop. These all have the data under /home/my_user/data, as I like to keep my paths consistent. So, when I connect my external media to these machines, practically they see the same repo path, though these are different repos.
Should I try to create multiple repos with the same path, or should I just add one
Can I expect any major issues from this set-up?
My way of dealing with this is to create a symlink in the root directory that point to the root directory, like
where
compname
is the hostname for the computer. Now you can create paths likeThis is also useful in other scripts where fetching data from the right directory on the wrong computer is bad. Also, this is a cheap way for a script to determine which computer it's running on:
sunny256 has a nice approach with the symlinks to make the paths to the remores explicitly contain the machine name.
However, if you want to keep it simple, it's perfectly fine for a remote's path to point to a directory which has different repositories mounted on it at different times. I do this in my own removable media drives, so the "host" remote uses /home/joey/sound, for example.
This is safe to do because git-annex always checks the UUID of the remote before using it. For a local path like this, it will automatically update the cached annex-uuid of the remote when it finds a repo with a different UUID mounted. (For a path to a repo on a remote server, it uses other methods to verify that it's accessing the repo with the UUID it expected.)
The only thing I'd be careful about doing is switching the repository that is mounted at a path with another one while git-annex is running, since it only checks at startup and won't notice the substitution and could get confused.