The way this repository uses for storing my dotfiles is with a bare repository. This makes it easy to clone, and it doesn't need to use system links.
The technique consists in storing a Git bare repository in a "side" folder (like
$HOME/.cfgor$HOME/.myconfig) using a specially crafted alias so that commands are run against that repository and not the usual.gitlocal folder, which would interfere with any other Git repositories around.
Install git.
Warning
If you install git using brew you will break completion.
Use this command:
git clone --bare git@github.com:datwaft/dotfiles.git $HOME/.dotfilesThis will clone the contents of the remote repository (the .git link) to the home directory (~) while referencing ~/.dotfiles as the local bare repository (the
—seperate-git-dirpart).
After that add the alias to the current shell scope:
alias .git='git --git-dir ~/.dotfiles --work-tree ~'And after that do a checkout to add the files to the home directory:
.git checkoutWarning
Your home directory shouldn't contain any of the dotfiles present inside the directory.
Here: https://www.atlassian.com/git/tutorials/dotfiles
And Here: https://martijnvos.dev/using-a-bare-git-repository-to-store-linux-dotfiles/