Like any other git repository, git-annex repositories have remotes. Let's start by adding a USB drive as a remote.
# sudo mount /media/usb
# cd /media/usb
# git clone ~/annex
# cd annex
# git annex init "portable USB drive"
# git remote add laptop ~/annex
# cd ~/annex
# git remote add usbdrive /media/usb/annex
This is all standard ad-hoc distributed git repository setup. The only git-annex specific part is telling it the name of the new repository created on the USB drive.
Notice that both repos are set up as remotes of one another. This lets either get annexed files from the other. You'll want to do that even if you are using git in a more centralized fashion.
git annex fsck
complained that I had only one copy per file even though I had created my clone, already. Once Igit pull
ed from the second repo, not getting any changes for obvious reasons,git annex fsck
was happy. So I am not sure how my addition was incorrect. -- RichiHgit remote add laptop ~/annex
? this remote already exists under the name origin.git remote add usbdrive /media/usb/annex
? because the actual repo would be in /media/usb/annex, not /media/usb?Good spotting on the last line, fixed.
The laptop remote is indeed redundant, but it leads to clearer views of what is going on later in the walkthrough ("git pull laptop master", "(copying from laptop...)"). And if the original clone is made from a central bare repo, this reinforces that you'll want to set up remotes for other repos on the computer.