Dotfiles in Git
You'll put your shell, editor and tool configuration in a git repo with a bootstrap script, then test it on a fresh install that ends up looking exactly like your machine.
About
Your setup is the sum of a hundred small decisions, and most people keep them nowhere but on the one machine that will eventually die. Dotfiles in git mean the next machine takes ten minutes, and a bad edit is one git checkout from undone. The real test is a fresh install, which is why this badge ends in a virtual machine. The trap is committing a secret: an API key in a shell file, an SSH private key, a token in a tool's config. Grep before every push, and keep the private things in a file that git ignores.
At a glance
- Per requirement
- 25 XP
- Completion bonus
- 150 XP
- Requirements
- 5
- Takes
- One weekend
- Skill level
- Intermediate (months of practice)
- Cost
- Free
- Supplies
- Nothing special
- Where
- At home
- Other people
- On your own
Requirements
-
1
Collect your configuration into one repo. Start with .bashrc or .zshrc, your editor config, .gitconfig and .tmux.conf if you use it, and move them into a folder under git. Use symlinks, a bare repo, or a tool like stow, whichever you understand well enough to undo. Take a photo of the repo listing with git log showing the first commit. Photo
-
2
Scrub it for secrets, then push it to a remote. Grep the whole repo for key, token, password and the names of your email and cloud providers before you push. Move anything sensitive into a local file that your main config sources only if it exists, and add that file to .gitignore. Public or private is your call. Take a photo of the .gitignore and the remote URL. Photo
-
3
Write a bootstrap script that installs your packages and links your files. A list of packages fed to the package manager, then the links, then anything else like a plugin manager or a font. It must be safe to run twice. Take a photo of the script, or film it running on your own machine. Photo or video
-
4
Run it on a fresh install in a virtual machine and get your setup back. Install a clean copy of your distro in VirtualBox or virt-manager, clone the repo, run the script, open a terminal. If it isn't the same shell, prompt and editor you have on your desk, fix the script and run it again. Take a photo of the VM and your real machine side by side showing the same prompt and editor. Photo
-
5
Make one change on the VM, commit it, and pull it on your main machine. Add an alias or a keybinding in the VM, push, then pull on your desk machine and use it. That round trip is what makes the repo real. Take a photo of git log on both machines showing the same commit. Photo