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.

After doing the above with two required copy per file, git annex fsck complained that I had only one copy per file even though I had created my clone, already. Once I git pulled 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. -- RichiH
Comment by Richard Fri Mar 18 21:18:49 2011
Yes, you have to pull down location tracking information in order for fsck to be satisfied in that situation. But since this is a walkthrough, and neither fsck or numcopies settings are mentioned until later, it's ok for this pull to be described a few steps along in getting file content.
Comment by joey Sat Mar 19 11:35:38 2011
  • why the git remote add laptop ~/annex ? this remote already exists under the name origin.
  • doesn't the last command need to be git remote add usbdrive /media/usb/annex? because the actual repo would be in /media/usb/annex, not /media/usb?
Comment by dieter Sat Apr 2 16:24:33 2011

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.

Comment by joey Sat Apr 2 22:32:17 2011
Comments on this page are closed.