After years of using Linux I've built up a collection of customised config scripts for things like bash, vim, and screen. Having everything setup just how I want it is great, until I need to start working on a new computer. A simple solution is to copy all my config files over to the new computer, but it means I need to re-copy all the config files if I make any changes to them. This isn't too much of a problem if I'm only working on two computers, but it becomes a real pain with more.
The solution I've come up with (and I'm sure others have too) is to put all my config files into into a Git repository on GitHub. Any changes to the config files can be committed to the repository, and than a quick update operation other machines keeps all the config files in sync. In this post I'll describe how to set it all up.
Adding your config files to GitHub
You'll obviously need to install Git. On any debian based system this is as simple as:
sudo aptitude install git-core
You'll also nee to Signup for a free GitHub account, and create a new repository. GitHub uses public-key cryptography and SSH for authentication, so you'll need to create a SSH public key on each machine you'll be accessing GitHub from. Details of how to do this are given in their guide. After adding your public key details to your GitHub account page you're ready to add your config files:
git init git add .bashrc git add .vimrc git add <any other config files you want to add> git commit -m 'Initial commit' git remote add origin firstname.lastname@example.org:coderholic/config.git # Your URL will differ git push origin master
Now all your config files are on GitHub!
Setting up a new machine
You'll need to create a SSH public key on the new machine, just as you did on the previous one. Once you've done that:
Once you've done that:
git init git pull email@example.com:coderholic/config.git git remote add origin firstname.lastname@example.org:coderholic/config.git
And your setup will match your other machine!
The real benefit of storing your config files on GitHub is that it makes it really easy to synchronise changes between all your computers. After making a change on one computer:
git commit -a -m "Useful commit message goes here" git push origin master
Then all you need to do on your other machines is issue the following command:
git pull origin master
And you're synced!
If you're interested in seeing my config files you can see them on the GitHub page: http://github.com/coderholic/config/tree/master
For linux hosting needs on the other hand, try reading reviews from a reliable provider first.