If you use git then you should almost certainly create a global gitignore file to ignore things like that should almost never be version controlled, e.g.
You might be tempted to put this stuff in a per-repository .gitignore file. I think that’s fine (if you insist) for things that are guaranteed to be created in a working copy of a particular repository (e.g. __pycache__ in a Python project), and thus at particular risk of being merged by collaborators who don’t have a global gitignore like this. But I much prefer to avoid it for OS-specific or editor-specific stuff. Here’s why:
Other users of the repository do not care about the crap created by the operating system or the editor you happen to be using currently, and you don’t care about theirs. This stuff should not be in the shared, version-controlled configuration.
If you follow this advice, repository .gitignore files will contain only of project-specific configuration. They will be shorter and, if you work on a project with lots of collaborators, they will produce less history churn.