Skip to content

It could be valuable to have a global gitignore file that you fall back on in case you don’t have one for every project.

  1. Open your terminal and check if you have a global git config file set up by the following command:
git config --get core.excludesfile
  1. Create a global gitignore file. You can name it anything. I call mine .gitignore__global.
  2. Configure git by setting up the path for the global gitignore file you just created. I keep mine in a .dotfiles folder under my user. So in my case I do:
git config --global core.excludesFile '~/.dotfiles/.gitignore__global';

But change the path to where you saved the file.

Here’s how my global gitignore file looks like. It’s a good default for when I haven’t one set up for a project.