You need a global gitignore because there are environment/OS-specific files that should not be included in your project’s .gitignore

Make a ~/.gitignore_global file. For an example, here is mine:

.idea/        # IntelliJ IDE
.sass-cache/  # Sass cache
.vagrant/     # vagrant box builds
.DS_Store     # Mac-specific

And now add that to your global git config:

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