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.
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_private in turn, then symlinks it as
~/.gemrc in the usual way.
To keep things neat, Git also ignores the generated
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.