从Git跟踪中移除已经被忽略的文件 git rm -r --cached . 添加.gitignore文件到仓库 git add .gitignore 提交更改 git commit -m “Update .gitignore” 推送到远程仓库 git push origin master