Why doesn't Git ignore my specified file?

前端 未结 13 1527
野性不改
野性不改 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 18:01

    Another possible reasona few instances of git clients running at the same time. For example "git shell" + "GitHub Desktop", etc.


    This happened to me, I was using "GitHub Desktop" as the main client and it was ignoring some new .gitignore settings: commit after commit:

    1. You commit something.
    2. Next, commit: it ignores .gitignore settings. Commit includes lots of temp files mentioned in the .gitignore.
    3. Clear git cache; check whether .gitignore is UTF8; remove files -> commit -> move files back; skip 1 commit – nothing helped.

    Reason: the Visual Studio Code editor was running in the background with the same opened repository. VS Code has built-in git control, and this makes some conflicts.

    Solution: double-check multiple, hidden git clients and use only one git client at once, especially while clearing git cache.

提交回复
热议问题