12 ms·
Unofficial guide to dotfiles on GitHub
- okasaki 4y agoThere are so many utilities. Why not just use ansible? It can manage your dotfiles and much more (you can configure your whole machine).
- eternityforest 4y agoAnsible is wonderful. I'd strongly consider it if I wasn't against the idea of having interesting enough dotfiles to version. What I do with RasPi servers is I make a pull and a push playbook that live in a repo, which let me deploy what I have onto a new server, and pull any changes made in server web GUIs into the repo where I can commit them. Then of course any other random periodic task also becomes an Ansible task. If I had a use case for lots of random little scripts on my main machine, I think I'd choose Ansible over bash where practical, you get so many tools premade, and you can run local or remote all the same.
- azemetre 4y agoI’m slowly trying to make ansible playbook that pulls in my dot files and installs everything I need (node, rust, go, all my CLTs, etc).
- bengalister 4y agoI used to manage my dotfiles with stow (xstow actually) and do some simple links. Now I run an Ansible playbook that creates links or copy depending on the files and also install tools on different OSes. The big benefit is that it can be organized in a modular way with roles and tags, and sensitives files (like my gpg keys...) can be encrypted with the vault.
- otterpro 4y agoI've used my custom bash script for managing dotfiles for ages and also have tried all other tools, but just couldn't get it right because I work on multiple OS. Then I found https://github.com/rhysd/dotfiles https://github.com/rhysd/dotfiles. It is the only tool I know of that can support multiple OS (Linux, mac, windows). I have to work with multiple OS and having a single dotfiles repo has been great, especially its ability to set different config on different OS, well as a unified Unix-like config setting.
- jbaber 4y ago[This] way (linked from the tutorials section of the page) is a great way to version your dotfiles without symlinks or installer scripts. [This]: https://www.atlassian.com/git/tutorials/dotfiles https://www.atlassian.com/git/tutorials/dotfiles
- Jalad 4y agoWhich was inspired by this HN thread https://news.ycombinator.com/item?id=11070797 https://news.ycombinator.com/item?id=11070797
- MereInterest 4y agoWhat issue do symlinks have that makes them worth listing as a negative? Asking as someone who wrote an installer script to make symlinks a decade ago, and has used it whenever setting up a new computer ever since.
- sokoloff 4y agoI use them and have no issues, but some editors don’t respect symlinks when making backups when you’ve opened the symlink (Rename existing file, make new file with the old name, and now the symlink is renamed and subsequent updates are unlinked as well). I seem to recall I had to set an emacs var to avoid this behavior.
- _-david-_ 4y agoFlatpaks can be an issue depending on the sandboxing. The application may be restricted from accessing the target. Using a hardlinks works, so it isn't that big of an issue to have a couple hardlinks, but it is still something to keep in mind.
- CrystalCuckoo 4y agoEnabling/disabling systemd services is done via managing symlinks. Unfortunately, when disabling a service in systemd, it follows and remove symlinks which can remove your symlinked service files.
- ok_dad 4y ago
- Cyberdog 4y agotl;dr: Create a .gitignore in your ~ with an asterisk on the first line and `!.dotfilename` on subsequent lines; the asterisk means Git will ignore everything, and the ! means Git will un-ignore that specific file or directory. (Be sure to include the .gitignore file itself.) Use Git as normal and push. To deploy on another machine/account, the easiest method is to check out as normal into a temporary directory, then move the .git directory from that temporary directory into your ~ and run `git revert`. Git will see all of the missing dotfiles as changes to be reverted and revert them into existence.
- fb03 4y agoWow, thank you! This is pretty easy and without all the acrobatics you usually see people do when dealing with dotfiles.
- seri4l 4y agoOne potential drawback of doing that is that every directory under ~/ that is not itself part of another git repository becomes part of that git repository, which could make some programs act weird, particularly project auto-detectors in IDEs and such. To avoid that, one can rename the `.git` folder, effectively disabling auto-discovery, and run git with the option `--git-dir=<newname>`.
- Cyberdog 4y agoSo the IDE or whatever would basically traverse up the filesystem looking for the first directory with a .git subdirectory? I've never encountered something like that but I suppose it's possible. Do you know of any IDEs specifically that do that? At any rate, I didn't know renaming the .git directory was possible. Do you have to add the --git-dir option to every subsequent git command? Sounds like a pain but my dotfiles change rarely enough that I guess I could live with it if I had to.
- gryn 4y agoyou can also create a .git file with the path for the git-dir folder (git-dir: /path-to-git-folder/) but that is kind of like having the .git folder with the exception that some programs don't seem to support it.
- prokopton 4y agoTheir Vim-specific recommendations are woefully out of date.
- plaguepilled 4y agoCan you provide a link to more current recommendations for Vim? I've used this article so I'd like to know what it got wrong.
- statico 4y agoI’ve written a bit. Maybe it’s helpful. https://statico.link/vim3 https://statico.link/vim3 https://statico.link/dotfiles https://statico.link/dotfiles
- rgoulter 4y agoI used vim years ago, and the list looks like it was written then. e.g. the package management. vim-plug seems fine, it seems odd to me to mention the others. (Pathogen's readme now mentions that it recommends vim's built-in package management. Vundle and neoplug haven't had a commit in years). In terms of vim distributions, https://github.com/SpaceVim/SpaceVim https://github.com/SpaceVim/SpaceVim probably deserves a mention, as inspired by the popular Spacemacs. It'd probably be worth mentioning NeoVim.
- deleted 4y ago[deleted]
- gbraad 4y agoAlso, codespaces has an option to deploy (your) dotfiles by selecting a repo that will be used. It runs install or similarly named file to do so. https://docs.github.com/en/codespaces/customizing-your-codespace/personalizing-github-codespaces-for-your-account#dotfiles https://docs.github.com/en/codespaces/customizing-your-codes...
- Ocha 4y agoI highly recommend Mathias Bynens's dotfiles under the Inspirations section. Have been using it for many years now and it makes it so much faster for me to work in terminal.
- 21eleven 4y agoI have my home directory as a git repo: works great, simple, no symlinking
- rolobio 4y agoI have this as well. Easy to push and pull changes. I push to a private git server. I keep a second copy repo on a thumb drive so I can start my home directory on an offline computer.
- samuell 4y agoInteresting. But I guess there must be files that you don't check in because of size?
- blueflow 4y agoYou can .gitignore everything. I used to have my homedir as git repo, but abadoned that because it interfered with other git repos inside my home. Nowadays i have ~/.config as git root, with some symlinks supporting the programs that don't look there on their own.
- Barrin92 4y agoafter trying a few different ways i've settled on chezmoi which they also mention on their utilites page. it supports quite a lot of things that many other solutions miss like templates so that you can use the same repo across different operating systems and being able to run scripts just once, in order and so on. It's somewhat involved to set up but now across windows/linux/macos my entire setup is literally just a one-liner.
- encryptluks2 4y agoI really like chezmoi. It is powerful enough to setup an entire organizations dot files.
- itsjloh 4y agoI started using Chezmoi as well a year or so ago. Its the only one I've managed to stick with and not end up with a mess of different setups across machines.
- nvln 4y agoAfter fiddling around with lot of options, I have finally homed in on a nix / home-manager[1] based setup. There are a few minor annoyances on Mac OS that I haven't sorted out yet (most of them are symlink/permissions related), but so far it's been working great for everything including support for VSCode dev container dotfiles setup[2]. [1]: https://github.com/nix-community/home-manager https://github.com/nix-community/home-manager [2]: https://code.visualstudio.com/docs/remote/containers#_personalizing-with-dotfile-repositories https://code.visualstudio.com/docs/remote/containers#_person...
- pabs3 4y agoFolks have been storing their home directories in VCS for ages, some older resources: https://vcs-home.branchable.com/ https://vcs-home.branchable.com/
- marsven_422 4y ago
- gorgoiler 4y agoIt took me 20 years to have an important realization about version controlled dotfiles: what I wanted to do was manage a set of sensible, personalized, non-standard behaviours for each tool I used, and have a way of distributing those across systems. What I didn’t need at all, after all, was anything that installed different things on different hosts or classes of hosts. Luckily, every tool I want to configure has a config file option to include another file, so I have a working copy of my version controlled defaults here: ~/.config/defaults …and a one time installation script that makes various tool’s config files look like this: # begin defaults source ~/.config/defaults/tool.conf # end defaults local specific config here I am quite happy managing the local bits by editing files on local machines. All my configuration stuff splits into either “used everywhere” or “used just on this one host”, so that makes it easier. As soon as I figured this out I had to pinch myself as to why it had taken so long to come up with this idea.
- jacobmischka 4y agoI do something similar, though I use the "defaults" as the starting point and add overrides in local files which aren't checked in. Something like this: # .dotfiles/.bashrc # shared baseline config... if [ -f ~/.bashrc.local ]; then . ~/.bashrc.local fi
- OJFord 4y agoI still want the versioning of host-specific stuff though, as well as the backup (by having the repo on GitHub too), and easy reference to other hosts' config that I might want on my current one after all (or setting it up for the first time). I do this by having ~/.config/tool/blah.conf as you'd expect; but also ~/.config/by-host/$hostname/tool/blah.conf I agree 'classes of hosts' is way overkill for probably anyone's personal machines though. Only thing close to that I do is with aconfmgr for more system-oriented stuff - but that's all simply on the basis 'if SSD enable TRIM' type 'classes', no manual specification.
- CGamesPlay 4y agoA few years ago I spent some time developing my own solution to this, which I published on GitHub. I drew inspiration from the best dotfiles managers at the time, but I found deficiencies in all of them which is why I made my own. Basically: no configuration file, uses symlinks and not copies or templates, and can clean up files after you remove them. The result is dfm [0]. I talk more about the differences from other high-quality projects in the README. If you like DFM, I’d appreciate a star on GitHub so that I can hit 100 to qualify to be listed on the dotfiles.github.io list :) [0] https://github.com/cgamesplay/dfm https://github.com/cgamesplay/dfm
- jeffbee 4y agoThis is fascinating to me. I have been a unix user since 1994 and I have carried my dotfiles around with me. I almost never edit them. Things like "oh-my-zsh" just look to me like supply chain attacks as a service. What is the benefit of these dotfile schemes?
- arvinsim 4y ago> What is the benefit of these dotfile schemes? Not everyone has the time to create their own custom dotfiles. Some just want sane and beautiful terminal defaults.
- jeffbee 4y agoI certainly hope I did not give the impression that I spent a great deal of time editing these files. My zshrc is three lines, the last of which was added in the 90s.
- vxNsr 4y agoLiterally was just looking at doing this an hour ago. After deciding it’d be too much work I come to hn for my pre-sleep reading and find this, lol.
- deleted 4y ago[deleted]
- rmrfus 4y agoMy pick is yadm - clean way to setup working environment on any host any *nix-like OS and bootstrap it in seconds. password-store (plus yubikey) organically complements it with simple and effective way to access secrets on any host. However I'm using private gitea instance to store repos for both. Just because. :)
- samsquire 4y agoI create my .vimrc and .tmux.conf when I set up my machine or when I get annoyed at the defaults. I find the problem with "set and forget" kind of jobs is that you forget how to do something because someone else already did it for you, so you don't learn anything. It's similar to joining a complicated project where everything has been set up for you and all problems were solved and if you were to join a new project from day 1 you would have to learn everything again. (See setting up CI/CD, the structure of a java project, a gradle file, a maven POM, Dockerfiles, git, Kubernetes manifests and other devops tasks) You still need to learn how to do things. I want to be fluent in the tools I use, so I would rather do things from memory.
- cquintana92 4y agoShameless plug for "yet another" dotfile manager I'm writing. It doesn't get in the way, and allows you to manage them in quite a flexible way. Templating, conditional linking, copying, custom code execution... You name it! https://github.com/cquintana92/dotfilers https://github.com/cquintana92/dotfilers
- Aarvay 4y agoJust wanted to mention Stow[1] here, which I use to symlink my dotfiles on a new machine on a per app basis for many years now. My set up script just installs basic compiler toolchain and runs a bunch of stow commands based on Linux/Mac OS. I also adhere to XDG base spec[2] so I can keep my ~/ clean. 1: https://www.gnu.org/software/stow/ https://www.gnu.org/software/stow/ 2: https://wiki.archlinux.org/title/XDG_Base_Directory https://wiki.archlinux.org/title/XDG_Base_Directory
- ibnishak 4y agoHow do you manage dotfiles of apps that overwrite symlinks? Eg: Xfce frequently does it.
- petepete 4y agoStow is the answer as far as I'm concerned. It's been around forever, it's standard, available in every package manager, the defaults just work. I use it in combination with a make to automate the setup of a new install.
- EduardoRT 4y agoYeah, I don't understand why people like reinventing the wheel, Stow works, Make works, both are available everywhere, you don't need 30 layers of JS to manage dotfiles, I'm not against progress, but at least make something better than what's already around.
- Kolja 4y agoAlso, the latest version (>= 2.3.0, released June '19) has a new flag specific to managing dotfiles. When passing `--dotfiles`, stow replaces `dot-` at the beginning of filenames with `.` in the symlinks. The online help does not mention it, but the release notes and man pages do.
- allendoerfer 4y agoI do not like comments, which are basically upvotes, but yes, Stow is the answer and this should be the top comment.
- ZuBB 4y agoweirdly, nobody mentioned vcsh[1] yet. it's a git-based tool that gives all git goodies. I use it and a couple of bash micro scripts to pull/push the latest changes upon logging in/out into shell (again bash, but seeking for POSIX or fish-based version) [1] https://github.com/RichiH/vcsh https://github.com/RichiH/vcsh
- i_love_limes 4y agoIn 2015, GitHub sent me a DMCA takedown notice for a repository of dotfiles. When I tried to convince them how ridiculous that is, their only suggestion was to file a DMCA counter notice. Glad they've come a long way since then.
- wseqyrku 4y agoNot much work ou-of-the-box. In the home directory (~) run: git init git remote add origin https://github.com/username/dotfiles echo '/**' >> .gitignore; git add -f .gitignore git add -f .gitconfig git add -f .bash_profile # etc and push On the second machine: git clone https://github.com/username/dotfiles tmp --no-checkout mv tmp/.git . rmdir tmp git reset --mixed