Why doesn't Git ignore my specified file?

前端 未结 13 1545
野性不改
野性不改 2020-11-28 17:12

I added the following line to .gitignore:

sites/default/settings.php

but when I type git status it shows the file

13条回答
  •  借酒劲吻你
    2020-11-28 17:54

    .gitignore will only ignore files that you haven't already added to your repository.

    If you did a git add ., and the file got added to the index, .gitignore won't help you. You'll need to do git rm sites/default/settings.php to remove it, and then it will be ignored.

提交回复
热议问题