.gitignore无效 有个别文件不想跟踪,比如pycharm的配置文件。 但是这个文件已经被git跟踪的情况下,再加入.gitignore是无效的。 只需要: git rm --cached .idea/workspace.xml 而不是删除全部缓存