Hey All! I’m curious to hear the gritty details about how you synchronize your dotfiles (e.g. .bash_profile, .gitconfig) between multiple dev machines (e.g. your desktop and laptop) and/or to help simplify setting up new machines (e.g. a shiny new MacBook 💻).
Do you store them in a public or private GitHub repo? DropBox? Somewhere else? Once cloned to the target machine, do you install the dotfiles...
- Manually (e.g. moving files around, running a series of commands)
- By running a custom shell script stored alongside your config files
- Using an automation tool, such as Ansible or Puppet
- Using a “dotfile manager” such as GNU Stow, Dotbot or Homesick
If you’ve already written a blog post about your setup, feel free to link it. Otherwise, I’d love to hear what has been working well for you, and any pro tips you can share. There are a ton of options here, and so I’m very interested to learn more about what folks are actually doing in practice 🙌
Oldest comments (34)
I typically keep them all in the GitHub, luckily none of mine have any secrets or anything like that.
After you clone the repo on to your machine, how to you install them (e.g. symlinking files, etc.)? Do you have something like an “install.sh” script in the repo that you run?
That would be clutch! I typically just copy and paste if there are any updates, many changes outside of the base set ups are specific to the laptop for work vs personal !
Here’s my very personalize Makefile for installing which perhaps could be adapted.
github.com/jmervine/zshrc/blob/mas...
Which, when looking over just now for the first in quite a while, needs some clean up.
Hmmmm I like this enough that I might do it too. Right now I'm symlinking everything in a bash script which works well, but the uninstall would have to be manual at the moment. I like that
make
would kind of supervise all of that.That's exactly what I do!
Great, thanks for confirming 👍
There is some good stuff in here, I've not tried any yet though.
Do you store your local development config in the cloud?
Ben Halpern ・ Feb 1 '19 ・ 1 min read
Ah nice! Thanks so much for sharing this. I searched past #discuss posts and totally missed this 🤗
No problem, I've got it permanently on my reading list so I can refer back to it. Post back here if you find an option that works well. I haven't had a chance to try any yet.
For those that are interested, I found an old HackerNews thread, and Reddit Survey that have a ton of valuable perspectives. This article also provides a really nice explanation of the general practice that many people seem to be taking: store dotfiles in GitHub, and then install them via a simple script that symlinks files and runs any additional init logic.
Also, I’m porting some helpful links that folks have shared on Twitter:
I currently store them in a secret gist, but I'm creating an install command, and storing it in a secret GitHub repo. It will basically download everything I need and setup all the files to keep my aliases, ZSH themes, Spotify theme (using Spicetify), etc
Out of curiosity: why are you using a secret Gist? Are you storing secrets in there, that you wouldn’t want others to see?
Also, have you considered using a “dot file manager” such as YADM or Homeshick, as opposed to scripting your own solution?
I don't have any secrets within the files, not sure why I keep it private... Better safe than sorry I guess?
I didn't know they existed, actually! I discovered with your post. I might still finish my own as it will also install all the softwares I need and apply themes/plugins (For example, it would download VSCode and apply my themes and plugins). I might consider using the dot file managers for the dot files and keeping my "install script" just for the things it can't do.
I manage mine, as I’m sure many do, via a Github repo — as well as my vimrc. They both include make based installers for easy installation, as well as (very old) Dockerfiles for quick mucking container.
The dotfiles repo loads a
.localrc
to include things I don’t wish to share. Mostly very work specific aliases and functions.Admittedly, I don’t push nearly often enough, nor do I clean up the files within with any kind of diligence.
Very cool! I really like the “.localrc” idea. That seems like a great solution for keeping a public dotfiles repo for most of your settings, while being able to keep some things private 👍
I feel ashamed to say that I only care about my ohmyzsh dir and .zshrc file and store them on Dropbox (because of native Linux app) and symlink them whenever I start a new computer in order to have the same plugins and config across my laptops and workstations.
But I'm gonna check those solutions because that seems neat.
I just keep a dotfiles repo on GitHub and sync it / set it up with Ansible. It's nice because the same Ansible role works in WSL on Windows and a native Linux box.
Is the Ansible role code in the same dotfiles repo? That way you can clone it and run Ansible on it?
Nope, right now that specific Ansible role isn't open source since it has very personalized information in it specific to my development environment but if it were to be released, it would be in its own separate repo as a dedicated dotfiles Ansible role.
Then you would configure the role to set up your dotfiles. At some point I may refactor it all to be a general role, but it's not a super high priority at the moment. It mainly just clones my dotfiles repo and sets up symlinks.
Currently I have that functionality along with some other things all smashed together in a custom role, which happens to do other things besides dotfiles but is related to setting up a new WSL / Linux development environment.
I keep my dotfiles in a Github repository, alongside with a list of things to set up manually. There is a script I copied from somebody's dotfiles repo that does the symlinks. If I update a dotfile on one machine, I just pull from the other. I also have a
.bash_profile_priv
file that I load from.bash_profile
but do not commit, so that I can set there env variables and such that only make sense for one machine or are secrets.I also keep an install script that installs various packages and apps via brew, and detailed instructions how to configure manually the system and certain apps to my liking.
Spending time on this repo paid off big time. I have re-installed the system more than 5 times now using this repo and I can't imagine not having it. I don't have to think much during the process, I just follow my list :).
Ohhhh, symlinks 🤦♀️ Of course!
Thanks for sharing. I also use github to manage my dotfiles and I've been thinking about how I wanted to manage syncing them without making my home folder a git repo. I was halfway through setting up some bash scripts with rsync, but symlinks are so much less effort and will work better.
I store everything in an org file which I can choose to encrypt using the
:crypt:
tag. This file can live anywhere(GitHub, Dropbox, drive, etc etc). The dotfiles are stored in source blocks from which I'll tangle to the relevant place in the file system. This approach works really well if you are a heavy emacsen user.As a non-Emacs user (apologies!), I’m not too familiar with org files. Any pointers that could help me understand this solution a bit better? I’m really intrigued 🤗
I use dotbot with mine.