Where is .gitignore_global saved on OS X?

I have created a .gitignore_global file using the command [...]

The command

git config --global core.excludesfile ~/.gitignore_global

does not create any file. In other words, if ~/.gitignore_global did not exist beforehand, running that command does not create it.

The semantics of that command are

Set the path of the user-level (because of the --global flag) Git ignore file to ~/.gitignore_global.

In terms of implementation, that command adds the following entry

excludesfile = ~/.gitignore_global

under the core section of your ~/.gitconfig file, which is the default path for the user-level config file. See this section of the Pro Git book for more details about the three levels (system, user, repository) of Git configuration files.


In terminal: (macOS Catalina)

  1. touch ~/.gitignore_global
  2. open .gitignore_global add: .DS_Store
  3. git config --global core.excludesfile ~/.gitignore_global

And you're done 🎉