git-annex/doc/walkthrough/backups.mdwn

28 lines
1.1 KiB
Text
Raw Normal View History

git-annex can be configured to require that more than one copy of a file exists,
2014-02-20 18:48:09 +00:00
as a simple backup for your data. This is controlled by the
numcopies setting, which defaults to 1 copy. Let's
change that to require 2 copies, and send a copy of every file
to a USB drive.
2019-03-27 15:15:03 +00:00
$ git annex numcopies 2
$ git annex copy . --to usbdrive
Now when we try to `git annex drop` a file, it will verify that it
knows of 2 other repositories that have a copy before removing its
content from the current repository.
2014-02-20 18:48:09 +00:00
The numcopies setting used above is the global default.
You can also vary the number of copies needed, depending on the file name.
So, if you want 3 copies of all your flac files, but only 1 copy of oggs:
2019-03-27 15:15:03 +00:00
$ echo "*.ogg annex.numcopies=1" >> .gitattributes
$ echo "*.flac annex.numcopies=3" >> .gitattributes
Or, you might want to make a directory for important stuff, and configure
it so anything put in there is backed up more thoroughly:
2019-03-27 15:15:03 +00:00
$ mkdir important_stuff
$ echo "* annex.numcopies=3" > important_stuff/.gitattributes
For more details about the numcopies setting, see [[copies]].