With a couple of little commands, you’ll be able to ignore the .DS_Store files forever from your git repositories on mac!
Create (or append) the .DS_Store to a .gitignore file in your homedir.
echo .DS_Store >> ~/.gitignore
The following command will add the .gitignore file to the git configuration
git config --global core.excludesfile ~/.gitignore