As indicated in Atlassian's .gitignore tutorial, you could also use your repo's /.git/info/exclude file that you can easily edit with any text editor. It works the same as .gitignore.
I could easily ignore my intelliJ files, personal dockerfiles and stuff only I need to work with.