Search code examples
gitmacosgitignore

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?


Solution

  • 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.