Tech/HowTo/Home Directory Dot-files in Git

From lathama
< Tech‎ | HowTo
Jump to navigation Jump to search

Creation

For the creation of a repo of existing dotfiles in your home directory the process is like.

  1. Change your current working directory to your home
    cd ~/
    
  2. In your home directory create a .gitignore like:
    # Ignore all
    *
    
    # Double Negative Include
    !.gitignore
    
    # Specifically identify directories and files to keep
    !README.md
    !.bash_aliases
    
  3. Create a README.md for your sanity later

Install

To install the dot-files on a new user account

As your user
cd ~/
git init  
git remote add origin user@server.tld:user/dotfiles.git
git fetch  
git checkout -t origin/main