Sorry this page looks weird. It was automatically migrated from my old blog, which had a different layout and different CSS.

Publishing dotfiles with private information

Like many people I put my dotfiles on GitHub. A perennial problem is what to do with files which contain private information. For example, .gemrc includes my Gemcutter credentials and .gitconfig my GitHub credentials.

Unlike bash scripts, you can’t source one configuration file from another. So either you don’t publish these files at all — or you split them up, publish the public parts, then stitch them back together when you install them.

This is what I do now.

Example: gemrc

In my local dotfiles/ directory I have a gemrc_public and a gemrc_private. Git ignores the latter. When I rake install, the code creates gemrc, appends gemrc_public and gemrc_private in turn, then symlinks it as ~/.gemrc in the usual way.

To keep things neat, Git also ignores the generated gemrc.

Finally

This is basic stuff, but it’s always good to resolve the small niggles. It keeps coming up (e.g. Ryan Bates, Ryan Tomayko, and Stack Overflow) so hopefully this will provide a few people with another option.

Andrew Stewart • 31 March 2010 • Git
You can reach me by email or on Twitter.