.gitignore ignores only .gitignore files. Once you started tracking the file (as you did with files/conf.php ), it will not be ignored.
You can use git rm --cached files/conf.php to delete a file from git without actually deleting it from the file system. Once you commit this, the file will be ignored properly.
source share