一般是缓存的原因,清除本地git缓存 重新添加
git rm -r --cached .
git add .
git commit -m ‘update .gitignore‘
gitignore不生效的办法
原文:https://www.cnblogs.com/liliumss/p/15027699.html