Once a file has been committed your git repository, it won't get ignored, even if you change the .gitignore.
To get it to start ignoring, you need to first remove it from the git repository.
cd
to the folder that contains the problematic .DS_Store file, and then try:
git rm --cached .DS_Store
or, if that doesn't work, maybe
git rm .DS_Store