Ignore .DS_Store file forever

Git Q&A File: Ignore .DS_Store file forever

Remove step

1. Clean git cache

Clean all the cache from git

git rm --cached .DS_Store

2. Remove all .DB_Store file from the repository

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

3. Add .DS_Store to the global gitignore file

echo .DS_Store >> ~/.gitignore_global
git config --global core.excludesfile ~/.gitignore_global

Reference