.gitignore 文件不生效问题

只需要清空一下 git 本地的缓存提交一次即可。

先清掉 git 缓存

git rm -r --cached .
git add .
git commit -m "fixed untracked files"

使用 git status 查看

$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

最后push

git push
原文地址:https://www.cnblogs.com/ice5/p/14714379.html