I added the following line to .gitignore
:
sites/default/settings.php
but when I type git status
it shows the file
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.