I have a file (config.php), that is already commited to Git repository, but I want to ignore locally, i.e. I want that file to remain in repository, but force Git to ignore
If the file is already in the repository, and hence the Index/Staging area, then an update to .gitignore won't change that situation - It would keep beinging committed.
To remove the file from the Index/Staging area use git rm .