I have cloned an existing WordPress Docker instance. While working in a feature branch, I noticed that a config file is not yet included in the ignore. The wp-config.php should not be in the remote repositoy. So I added the wp-config.php to the gitignore. But this is not excluded for reasons that are not clear to me. The other files and folders are successfully ignored. If I create a new file and want to ignore it, it would work.
Now I ask myself, why is this? Why can't I ignore an existing file afterwards?
My .gitignore
dbdata
dev
webserver/wp-config.php
webserver/wp-admin
webserver/wp-content/uploads
webserver/wp-includes