Kokodoko
Kokodoko

Reputation: 28158

Where is .gitignore_global saved on OS X?

I have created a .gitignore_global file by running

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

However, I can't find the file in question in my file system? Where was it saved?

Upvotes: 22

Views: 13957

Answers (3)

Sentry.co
Sentry.co

Reputation: 5619

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 🎉

Upvotes: 42

Cloud9999Strife
Cloud9999Strife

Reputation: 3202

You can find the file location by running this command in Terminal:

git config --get core.excludesfile

Upvotes: 13

jub0bs
jub0bs

Reputation: 66404

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.

Upvotes: 24

Related Questions