Skip to content

Instantly share code, notes, and snippets.

@gioele
Last active April 7, 2018 23:12
Show Gist options
  • Save gioele/5650728 to your computer and use it in GitHub Desktop.
Save gioele/5650728 to your computer and use it in GitHub Desktop.
# Situation:
# * one laptop computer
# * one desktop computer
# * one remote server
# * one S3 bucket
#
# The laptop computer and the desktop computer have a directory ~/Docs with many GB of data.
# We do not want to download the data we already have
# Initial setup on the laptop computer
hostname # => laptop
cd ~/Docs/
git init .
git annex init "laptop"
git annex direct
git remote add origin git+ssh://remote.example.org/Docs.git # Docs.git contains an empty bare git repository
export AWS_ACCESS_KEY_ID=aabb11cc00
export AWS_SECRET_ACCESS_KEY=ee4422ffcc
git annex initremote s3 bucket=backup type=S3 encryption="gpg-email@example.net" datacenter=EU fileprefix="Docs/"
git annex add .
git annex copy --to s3
git annex sync
# Initial setup on the desktop computer
hostname # => desktop
mv ~/Docs ~/Docs.orig
git clone -n git+ssh://remote.example.org/Docs.git
cp -P --remove-destination -a ~/Docs.orig/* ~/Docs/ # beware of timestamps and hidden files, use rsync
cd ~/Docs
# FIXME: maybe use enableremote?
export AWS_ACCESS_KEY_ID=aabb11cc00
export AWS_SECRET_ACCESS_KEY=ee4422ffcc
git annex initremote s3 bucket=backup type=S3 encryption="gpg-email@example.net" datacenter=EU fileprefix="Docs/"
git annex add .
git annex sync
# ==========
# Add one file on the laptop
hostname # => laptop
git add .
git annex sync
# Fetch
hostname # => desktop
git annex sync
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment