Search code examples
gitignoregithub-for-windows

Ignore file with GitHub on windows


I use GitHub on windows, I cloned a wordpress project locally. At the root, the project contains the file .gitignore with lines :

*.log
wp-config.php

So I should not have the wp-config.php file in the root, however wp-config.php is present locally.

If I right-click > "Ignores file" on the client: a new line is added to the file .gitignore but my file is not ignored.

Do you know why ?

Thank you !


Solution

  • One possible explanation for what you are seeing is that the file wp-config.php is already being tracked by Git. Doing git status will tell you what is happening. If the file is already being tracked then you must do the following command in addition to adding it to .gitignore:

    git rm --cached wp-config.php