Skip to content

My Linux dotfiles basic setup

License

Notifications You must be signed in to change notification settings

gitolicious/dotfiles

Repository files navigation

dotfiles

My Linux dotfiles basic setup.

The approach was stolen from a Medium article by Flavio Wuensche which in turn is based on Hacker News solution proposed by StreakyCobra

This is highly personalized to my own personal needs but feel free to adapt to yours. It works with major distributions (tested with Alpine, Ubuntu and Debian) natively, in a Docker container as well as for VS Code devlopment containers.

Getting started

If you're starting from scratch, go ahead and create a .dotfiles folder, which we'll use to track your dotfiles

git init --bare $HOME/.dotfiles
  • create an alias dotfiles so you don't need to type it all over again
alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
  • set git status to hide untracked files
dotfiles config --local status.showUntrackedFiles no
  • add the alias to .zshrc (or .bashrc) so you can use it later
echo "alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'" >> $HOME/.bashrc

Usage

Now you can use regular git commands such as:

dotfiles status
dotfiles add .vimrc
dotfiles commit -m "Add vimrc"
dotfiles add .bashrc
dotfiles commit -m "Add bashrc"
dotfiles push

Nice, right? Now if you're moving to a virgin system...

Setup environment in a new computer

Make sure to have git installed, then:

  • clone your github repository
git clone --bare https://github.com/USERNAME/dotfiles.git $HOME/.dotfiles
  • define the alias in the current shell scope
alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
  • checkout the actual content from the git repository to your $HOME
dotfiles checkout

Note that if you already have some of the files you'll get an error message. You can either (1) delete them or (2) back them up somewhere else. It's up to you.

Now go on and install apps and plugins.

Awesome! You’re done.

Simpler version

Everything is combined in the bootstrap file for convenience.

bash -c "$(curl -fsSL https://raw.githubusercontent.com/gitolicious/dotfiles/main/bin/bootstrap.sh)"

This can be used in VS Code Remote Containers by adding the following line to ./devcontainer/devcontainer.json

"postCreateCommand": "bash -c \"$(curl -fsSL https://raw.githubusercontent.com/gitolicious/dotfiles/main/bin/bootstrap.sh)\"",

If you don't need thefuck, you can save some installation time for its dependencies such as python by adding the --fuck-off argument or setting the FUCK_OFF environment variable.

About

My Linux dotfiles basic setup

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published