As in the documentation, it clearly says that
Patterns that are specific to a particular repository but which do not need to be shared with other related repositories (e.g., auxiliary files that live inside the repository but are specific to one user’s workflow) should go into the $GIT_DIR/info/exclude file.
The .git/info/exclude file has the same format as any .gitignore file.
Another option is to set core.excludesFile to the name of a file containing global patterns.
Note: if you already have unstaged changes you must run the following after editing your ignore-patterns
git update-index --assume-unchanged [<file>...]
So that the specified files configure git to ignore some files locally.