You should add following lines while creating a project. It will always ignore .DS_Store
to be pushed to the repository.
*.DS_Store
this will ignore .DS_Store while code commit.
git rm --cached .DS_Store
this is to remove .DS_Store files from your repository, in case you need it, you can uncomment it.
## ignore .DS_Store file.
# git rm --cached .DS_Store
*.DS_Store