Index

I’ve got a desktop and server behind a router with a dynamic IP address at home, a desktop at work, and a laptop that floats around. I’d very much like to have the same settings on all of them, and to be able to synchronize them as easily as possible. I’ve been using Subversion for this, but recent trouble with symlinks and a long-term concern that storing the revision history centrally (even with backups now and then) is a Bad Move in the long term. So when I had to start using Git at work, and after realizing that it could solve both problems (at least in theory), I tried figuring out how to do this. After lots of tries followed by rm -rf settings/, I think I’ve got a working setup. Of course, I don’t guarantee that any of this will work for you.

The main idea here is to set up Git “remotes” pointing to all the other machines.

To be able to get the updates from the repository in ~/settings on my.example.org, simply run the following on all machines (except, of course, the home machine):git remote add home ssh://home-pc.example.net/~/settings

To be able to get the updates from the “work” host specified with a proxy above, just use “work” for the host name:git remote add work ssh://work/~/settings

To be able to pull from a machine which changes IP address, you could set up a DynDNS account and use one of their recommended update scripts to be able to refer to your machine using a single DNS name.

After cloning one of the copies on all of your hosts, you should be able to do the following to get all the changes from the repositories:git remote update && git pull
If this doesn’t work, you might have more luck fetching each repository individually, and then rebasing to it:git fetch home && git rebase home/master

To keep a backup on a separate machine, just do agit clone --origin example ssh://example.org/~/settings
there and set up pushing defaults on the other machines usinggit config push.default matching
git remote add backup ssh://backup.example.org/~/settings
Then you can just git push backup master to backup the local master branch.