在项目目录下打开git命令行, git rm -r --cached .(带空格的点) git add .(带空格的点) git commit -m 'update .gitignore'这样就可以更新.gitignore文件了