1 minute read

Everyone who works on multiple computers faces the problem of unifying personal environment settings. When working in *nix/linux, you quickly develop your own favorite set of aliases, bash functions, prompts, and environment variables. Settings for other programs matter too: vim, emacs, git.

Most settings on *nix systems are stored in simple text files and can be easily copied to a new server. However, as the number of servers grows, you face limitations. Which version is the main master copy? What if your servers run multiple operating systems with different settings? What if you can’t quickly download settings to all servers—say, they’re on your work machine behind a firewall?

Distributed version control systems, such as git and mercurial, coupled with cloud hosting for personal repositories, significantly reduce these problems. I use public hosting on github. If you want private settings, other options exist (for example, unfuddle offers free private hosting for git and svn repos).

Steps:

  1. Register on github.
  2. Create a new personal repo for your settings.
  3. Clone it to your computer (git clone <url>).
  4. Edit your ~/.bashrc, ~/.vimrc, and other personal settings files, extracting universal aliases, functions, and other common settings into separate files in your cloned repo.
  5. Include universal settings in ~/.bashrc.
  6. git add && git commit
  7. Clone settings to other servers and edit the corresponding .bashrc (as in step 6).

Here’s my settings repo as an example.

Pros and cons

Pros

  • Setting up a copy on each system takes minutes.
  • You have change history on each system without needing access to a central server (if you use a distributed version control system—git, hg, etc.).
  • You can have custom versions of settings for different OSes or purposes (git branch freebsd && git checkout freebsd…).
  • You can have universal settings for a team or workgroup.

Cons

  • You need a git (hg, svn, bazaar…) client on each machine. However, installing the necessary package takes only minutes.

Comments