Skip to content

Instantly share code, notes, and snippets.

@AmmarHaddadi
Created November 14, 2022 12:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AmmarHaddadi/9f303ba3a6c62d5f38221dcbf5b6e8c5 to your computer and use it in GitHub Desktop.
Save AmmarHaddadi/9f303ba3a6c62d5f38221dcbf5b6e8c5 to your computer and use it in GitHub Desktop.
how to track dotfiles on github

Steps

  1. make sure you're in the your ~home directory , you can type cd or ~ to go there

  2. git init --bare $HOME/dotfiles

you can replace dotfiles with a name of choice , I chose .dotfiles

  1. echo alias config='/usr/bin/git --git-dir=$HOME/dotfiles/ --work-tree=$HOME' >> .zshrc

feel free to name the alias what ever you want , I named it dotfiles this adds an alias named config , so instead of typing git --git-dir=home/dotfiles all you need to do is to write config in your terminal on bash replace .zshrc with .bashrc

  1. restart the shell to load the new config file

  2. config config --local status.showUntrackedFiles no

again , the first config is the name of the alias so you might need to adjust this command this one hide untracked files when you type config status

  1. config add <file or folder name here>

  2. It's really up to you now , I hope you push your awesome files online !

be careful , never upload ur .SSH keys , git credentials or anything that contains personal info !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment