How to Remove .DS_Store files from a Git repository?
Sometimes .DS_Store files are there at remote repository, but not visible at your local project folders. To fix this, we need to remove all cached files and add again.
Step 1: Create a new file with name .gitignore and put it in the root of source code folder that you want to push up to Github.
Step 2: Add this to .gitignore file to Ignore Mac DS_Store files
.DS_Store
**/.DS_Store
Step 3: Remove the cached files and add again using these commands.
git rm -r --cached .
git add .
git commit -am "Removed git ignored files"
git push -f origin master