EMZETT.
Login

Dotfiles and configuration management

In short: Dotfiles are the hidden configuration files in the home folder (.bashrc, .vimrc, .config/...). Whoever manages them in a Git repository sets up a new computer in minutes the way they like it.

Where are the settings?

Files and folders whose name starts with a dot are hidden (ls -a). Common: ~/.bashrc (shell), ~/.gitconfig, ~/.ssh/config (never put the private key in the repository!) and the folder ~/.config/ for modern programs.

Storing in Git

Simple method: collect all files in a folder ~/dotfiles, version them in Git and place them with symlinks:

mkdir ~/dotfiles && cd ~/dotfiles && git init
mv ~/.bashrc bashrc
ln -s ~/dotfiles/bashrc ~/.bashrc

GNU Stow

The tool stow sets the symlinks automatically. One folder per program (bash/.bashrc, vim/.vimrc); stow bash vim links everything.

Going further

  • chezmoi and similar tools: templates for different machines and encrypted secrets.
  • Nix Home Manager describes the whole user environment declaratively, see NixOS and Gentoo.
  • Ansible for whole machines, see Ansible for beginners.

Rules

  1. No passwords or keys in a public repository.
  2. A script that sets everything up.
  3. Comment your changes.

See also: Git