清除本地仓库缓存 git rm -r --cached . 本地代码重新加入 git add . 3.让 .gitignore 文件夹生效,读取配置过滤规则 git commit -m "update .gitignore"