Git still adds and tracks folders marked in .gitignore

This question already has an answer here:

  • Ignore files that have already been committed to a Git repository [duplicate] 21 answers

  • The reason it isn't working is (probably) because you added some of those files before you added the .gitignore - so you have to remove them from git before they're able to be ignored.

    Source: https://stackoverflow.com/a/1139797/2128691

    First, commit any outstanding code changes , and then, run this command:

    git rm -r --cached .
    

    This removes everything from the index, then just run:

    git add .
    

    Commit it:

    git commit -m ".gitignore is now working"
    
    链接地址: http://www.djcxy.com/p/23398.html

    上一篇: 如何忽略用git跟踪文件的新变化?

    下一篇: Git仍会添加并跟踪标记为.gitignore的文件夹