I configured git-annex to keep track of a directory containing several GB of data. Its content is replicated on an S3 remote, so I can drop some files to free some space and get them back when I need them.I also have another computer where I would like to do the same thing. This other computer already contains most of the files that are stored on the S3 remote.How can I tell git-annex to init a new repository on this other computer without downloading from S3 the files that it can find in the local directory?
Init gix-annex additional repo with existing files
git annex
EDIT 2015-04-30:anarcat wrote up a guide for this use case that he posted in the comments for this answer.EDIT 2013-05-31:Thanks for accepting! gioele pointed out in the comments that reinject doesn't work in direct-mode git annex repos, which makes sense, and kinda takes the wind out of my answer. slm found an alternative method using git annex add, which it looks like gioele went with. Check out slm's answer for more information on this.OriginalHaven't heard of git annex; that's a cool tool!Ok, from what I've read of it on git annex's website, on the new computer you can do git clone from the S3 repository and it won't be expensive, since it's only copying symlinks. Then cd into it and git annex init <reponamehere> as usual to make git annex aware of the repo.As far as I understand it, the tricky thing you're trying to do is make git annex aware of that machine's local copies of the repo's data. I found a command on its man page called reinject that I think will do what you want:git annex reinject /path/to/files/* /path/to/repoYou may want to add the --fast option which might disable the fsck (git annex's term for checksumming the files) which is automatically performed by reinject. That of course is a bit dangerous and may not even work: it's not clear whether reinject accepts --fast or not.Also, you may need some kind of find one-liner if the files you want to reinject are more complicated than a single directory. Something like:find /path/to/files/* -type f -exec bash -c 'echo $1 /path/to/repo/${1#/path/to/files}' -- '{}' \;That one will (I think) echo the path of every file in /path/to/files while echoing a target path in your repo with /path/to/files stripped off. Replace echo with git annex reinject once you've run it and you're sure the output is doing what you intend. Using find in conjunction with bash -c brings great power and great responsibility :) Source: working in a data analysis job that involves a hilarious amount of batch operations on files, and pretty much being in love with git.