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!'


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


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


and add Some common .gitignore configurations