How Can I Remove .DS_Store Files From A Git Repository?

find . -name .DS_Store -print0 | xargs -0 git rm --ignore-unmatch

Also add “.DS_Store” to your git “.gitignore” file

git add .gitignore
git commit -m '.DS_Store bye bye!'

UPDATED

You might want to exclude some file for a specific repository then you can use:

your-repo/.git/info/exclude

In case you want to exclude files globally, in the root create:

.gitignore_global

and add Some common .gitignore configurations