3

I want to completely ignore .idea folders in all my Git repositories. I want my repositories to not even know about files in this folder, so placing .gitignore file each time is not an option. I tried to globally set core.excludesfile in my global Git config, but it doesn't seem to work:

[core]
    excludesfile = .idea/**

Plus, it overwrites my system ignores, like .DS_STORE files. How can I ignore .idea folders entirely without letting know my repositories about these folders?

Robo Robok
  • 21,132
  • 17
  • 68
  • 126
  • It's always a good idea to have a git project self-contained, i.e. not depend on global settings. Do you really create a new git project so often? – rustyx Aug 21 '16 at 21:37
  • http://stackoverflow.com/questions/7335420/global-git-ignore ? –  Aug 21 '16 at 21:37

1 Answers1

5

As described in the git config documentation, core.excludesFile is not a pattern, but rather the name of a file that contains patterns:

core.excludesFile

       Specifies the pathname to the file that contains patterns to describe paths that are not meant to be tracked, in addition to .gitignore (per-directory) and .git/info/exclude. Defaults to $XDG_CONFIG_HOME/git/ignore. If $XDG_CONFIG_HOME is either not set or empty, $HOME/.config/git/ignore is used instead. See gitignore(5).

Hence you should be putting .idea/** (or just .idea or .idea/*) in some file, and pointing core.excludesFile to that file if that is not already the default file.

Community
  • 1
  • 1
torek
  • 448,244
  • 59
  • 642
  • 775