一、启动Git Bash并切换到项目目录下 二、执行下列语句: git rm -r --cached . git add . git commit -m 'update .gitignore' 三、OK。