How to use Github to manage dotfiles?

nfpyfzyf picture nfpyfzyf · Apr 30, 2013 · Viewed 18.3k times · Source

I stored my dotfiles in github, with lots pains, because of no automation. I have to update it myself.

Is there a way that can auto install/update/sync dotfiles? I mean in a fresh server, I download dotfiles and exec a install script to copy dotfiles to local. After some time, I can exec a updateToRemote script to push local changes to remote repo, and on another server, I can exec a updateToLocal script to pull remote changes to local.

Something like that.

Answer

VonC picture VonC · Apr 30, 2013

The main source of information about dotfiles is dotfiles.github.io.

It references blog posts like Using Git and Github to Manage Your Dotfiles, based on a symlink method.

For starters, we’ll be putting all of our dotfiles into a folder called dotfiles, like so: /home/smalleycreative/dotfiles/vimrc.
Then, we’ll simply symlink to them from our home directory.


Jaime mentions the Atlassian tutorial "The best way to store your dotfiles: A bare Git repository"

The technique consists in storing a Git bare repository in a "side" folder (like $HOME/.cfg or $HOME/.myconfig) using a specially crafted alias so that commands are run against that repository and not the usual .git/ local folder, which would interfere with any other Git repositories around.
(and then the dotfiles folder is managed as a git repo)