git remove cache 若在提交.gitignore之前,不小心提交了无用的文件入repo,可以用以下命令在repo中去除这些文件 git rm -r --cached <filename or .> git add . git commit -m '.gitignore is now working' 源地址:http://stackoverflow.com/questions/1139762/ignore-files-that-have-already-been-committed-to-a-git-repository