Why doesn't Git ignore my specified file?

前端 未结 13 1327
野性不改
野性不改 2020-11-28 17:12

I added the following line to .gitignore:

sites/default/settings.php

but when I type git status it shows the file

相关标签:
13条回答
  • 2020-11-28 18:13

    Please use this command

    git rm -rf --cached .
    git add .
    

    Sometimes .gitignore files don't work even though they're correct. The reason Git ignores files is that they are not added to the repository. If you added a file that you want to ignore before, it will be tracked by Git, and any skipping matching rules will be skipped. Git does this because the file is already part of the repository.

    0 讨论(0)
提交回复
热议问题