Using git for sync and backup to a NAS

git can be the ideal choice for some sync and backups tasks where maintaining the history is important. Even if the history becomes less important over time, you can simply blow the repository away and recreate it from your local working copy without any history, or even use some interesting commands to do this. Hopefully soon someone will create something that uses gits concepts to do this and allow history rewriting / squashing although this does go against the immutability concepts in git.

For this example, I have a local photos repository (/Users/kris/Pictures/shared/.git) that I want to make available on the nas (mounted at /Volumes/share/):

git clone --bare --no-hardlinks /Users/kris/Pictures/shared/.git /Volumes/share/shared/photos.git
git remote add share /Volumes/share/shared/photos.git

This first does a bare clone of the local repo to the nas, then sets the remote for the local repo to the clone on the nas.

Provided the nas is mounted, the git repository can be used under normal workflows.


blog comments powered by Disqus
Fork me on GitHub