1.Remove existing files from the repository:
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
2.Add the line
.DS_Store
to the file .gitignore, which can be found at the top level of your repository (or created if it isn’t there already). You can do this easily with this command in the top directory
echo .DS_Store >> .gitignore
3.Then
git add .gitignore
git commit -m '.DS_Store banished!'
提示:直接复制命令段,以免出错,尤其是第一条