Git and SSH

Set up a global .gitignore

Stop system junk and secrets like .DS_Store and .env from ever being committed, in every repo.

  1. Create the file and tell Git to use it
    Terminal
    git config --global core.excludesfile ~/.gitignore_global
    printf '.DS_Store\n.env\n.env.local\n.vscode/\n.idea/\nnode_modules/\n' >> ~/.gitignore_global

Check it worked

  1. Check Git is using it
    Terminal
    git config --global core.excludesfile && cat ~/.gitignore_global
Undo it
  1. Remove it
    Terminal
    git config --global --unset core.excludesfile && rm ~/.gitignore_global
  1. Create the file and tell Git to use it
    Terminal · Ubuntu / Debian
    git config --global core.excludesfile ~/.gitignore_global
    printf '.env\n.env.local\n.vscode/\n.idea/\nnode_modules/\n' >> ~/.gitignore_global

Check it worked

  1. Check Git is using it
    Terminal · Ubuntu / Debian
    git config --global core.excludesfile && cat ~/.gitignore_global
Undo it
  1. Remove it
    Terminal · Ubuntu / Debian
    git config --global --unset core.excludesfile && rm ~/.gitignore_global
  1. Create the file and tell Git to use it
    PowerShell
    git config --global core.excludesfile "$env:USERPROFILE\.gitignore_global"
    Add-Content "$env:USERPROFILE\.gitignore_global" "Thumbs.db", "desktop.ini", ".env", ".env.local", ".vscode/", ".idea/", "node_modules/"

Check it worked

  1. Check Git is using it
    PowerShell
    git config --global core.excludesfile; Get-Content "$env:USERPROFILE\.gitignore_global"
Undo it
  1. Remove it
    PowerShell
    git config --global --unset core.excludesfile; Remove-Item "$env:USERPROFILE\.gitignore_global"