Well, that is what a global gitignore file [1] is all about. Entries specific for your working environment (IDE-files) should be defined in your global gitignore, while everything project-specific (object files, build-directory etc.) should be in the project-gitignore.
[1] git config-option: --global core.excludesfile