System-wide global .gitignore

Many IDEs create per-project cache directories with metadata relevant to the IDE configuration for that project. Instead of editing the .gitignore file for each repository, ignore directories in Git system-wide for all repos as follows, for any operating system.

Tell Git where the global ~/.gitignore file is:

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

Edit the ~/.gitignore file like: