.gitignore is ignored by Git

前端 未结 30 1944
梦毁少年i
梦毁少年i 2020-11-22 02:51

My .gitignore file seems to be being ignored by Git - could the .gitignore file be corrupt? Which file format, locale or culture does Git expect?

30条回答
  •  一个人的身影
    2020-11-22 03:20

    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 temporary files mentioned in the .gitignore.
    3. Clear Git cache; check whether .gitignore is UTF-8; remove files → commit → move files back; skip one commit – nothing helped.

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

    Solution: double-check multiple, hidden Git clients and use only one Git client at a time, especially while clearing the Git cache.

提交回复
热议问题