步骤 有时候在项目里引入.gitignore文件,但是文件没起作用,还是会提交一些无关紧要的东西。 解决如下: 1》清除本地库的缓存 git rm -r --cached . 2》将本地代码重新加入 git add -A 3》让 .gitignore文件生效,读取我配置的过滤规则 git commit -m “update .gitignore”