Not sure if this use case is supported, but I have the following setup - I use git-annex to store my Lightroom catalog and photos. My local machine does not contain all files, .mov
files for example are excluded via the preferred content mechanism. The full backup is on a remote server using ssh.
Now I want to create another copy of the data (encrypted) from my local machine to a USB stick or similar. I found that the locally excluded files are not synced. In order to copy all the data I first need to change the preferred content config, execute git-annex get
to fetch the data, then copy via git-annex sync myusbremote --content
, then change the local preferred content pattern, then run git annex drop --auto
to delete the local unwanted content again.
I was wondering if there's a way to sync from one remote to another, without storing any data locallly ? Something like git-annex sync --from ... --to ...
.
Is there a full git repos on the usb stick? if yes You could add a remote on it and run
git annex --content
from there.You could also try to change the preferred content of your local machine to include something like "--not --in=usb". With this you local repos will download file not in the usb stick, copy it to the usb stick and then remove it from the local repos. (I didn't check exactly the syntax of the preferred content, so my expression could be incorrect, but I hope you get the idea)
--not --in=usb
exclude a lot of content I actually want ? (Haven't tried it yet)Well my idea wasn't to have only this in the preferred content. You can use "or" expression.
That said, I've just check the manual, and it seem that there is no --in for preferred content... But you could add your usb repos say to the archival group (git annex group usb archival), Then use something like like
"include=* and ( exclude=*.mov or not inallgroup=archival )"
(this is untested, but I hope you get the idea).With such a preferred content, you local repository should get (and keep) the .mov not in usb, and should drop them when they are send there.
Remi's idea of using preferred content can be made to work.
There's no
git annex copy --from A --to B
. It would need to locally spool each file into the current repo, and being an unusual corner case has not seemed worth doing so far.I can confirm that Remi's suggestion does work as expected, thanks!
To do that, I created a simple bash script that get locally the files and then copies them to the remote
https://github.com/Konubinix/Devel/blob/master/bin/git-annex-getcopy.sh
I hope that helps.