75 lines
3.0 KiB
Markdown
75 lines
3.0 KiB
Markdown
# Dotfiles
|
|
|
|
**Dotfiles for [@dominikdoerr](https://fosstodon.org/@dominikdoerr)**
|
|
|
|
Dotfiles are user-specific configuration files. They are called dotfiles, because on linux most configuration files start with a dot (like .bashrc) to mark them as hidden. To be able to migrate or restore those configuration files without much hassle they can be committed to a git repository. Now they can quickly be installed on every system with internet access.
|
|
|
|
These are the configuration files for my linux setup (running Debian on a Thinkpad X230). Feel free to use this as inspiration or starting point for your own setup. I try to comment my settings as much as possible (as I tend to forget the more obscure settings on a regular basis).
|
|
|
|
---
|
|
|
|
## Install these dotfiles onto a new system
|
|
|
|
If you are using bash, the alias will be included in the .bash_aliases file. Add this alias to your shell configuration file, if you use another shell.
|
|
|
|
```
|
|
alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
|
|
```
|
|
|
|
Clone this repository as a bare repository into your home folder.
|
|
|
|
```
|
|
git clone --bare https://gitlab.com/dominikdoerr/dotfiles $HOME/.dotfiles
|
|
|
|
# Checkout the repository to add the files to your home folder.
|
|
# Make sure to set the alias for your shell first.
|
|
# This command may fail, if you have files already present (like a .bashrc). Move or delete these files and run the command again.
|
|
dotfiles checkout
|
|
|
|
# Set the flag to only track explicitly added files.
|
|
dotfiles config --local status.showUntrackedFiles no
|
|
```
|
|
|
|
Now you are set up and can use your own dotfiles.
|
|
|
|
---
|
|
|
|
## How to create your own dotfiles
|
|
|
|
Maybe you want to create your own dotfiles but start from scratch instead of cloning and modifying this repository. My setup basically follows this [guide from Atlassian](https://www.atlassian.com/git/tutorials/dotfiles).
|
|
|
|
|
|
```
|
|
# Create a separate folder for git to track the files
|
|
git init --bare $HOME/.dotfiles
|
|
|
|
# Add an alias for your shell (I use bash).
|
|
# As I am using aliases a lot, I use a separate file instead of adding it to the .bashrc.
|
|
# We use this alias instead of the regular git command.
|
|
echo "alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'" >> $HOME/.bash_aliases
|
|
|
|
# Set a flag to only show explicitly added files.
|
|
# Otherwise git will try to track all the files in our home directory.
|
|
# Note that we already use our alias. You have to source your alias file first or restart your shell to make this work.
|
|
dotfiles config --local status.showUntrackedFiles no
|
|
```
|
|
|
|
Now you can manage your dotfiles with git using the new alias. Just use 'dotfiles' instead of 'git'. For example:
|
|
|
|
```
|
|
dotfiles status
|
|
dotfiles add .bash_aliases
|
|
dotfiles commit -m "Add aliases file for bash"
|
|
dotfiles push
|
|
```
|
|
|
|
---
|
|
|
|
## Questions and contact
|
|
|
|
Got questions or feedback? Please do get in touch. I'm always looking for improvements and am happy to help if I can.
|
|
|
|
* [Visit my website](https://dominikdoerr.de)
|
|
* [Write me an email](mailto:foss@dominikdoerr.de)
|
|
* [Get in touch on Mastodon](https://fosstodon.org/@dominikdoerr)
|