.gitignore is ignored by Git

前端 未结 30 1382
梦毁少年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:18

    For me it was yet another problem. My .gitignore file is set up to ignore everything except stuff that I tell it to not ignore. Like such:

    /*
    !/content/
    

    Now this obviously means that I'm also telling Git to ignore the .gitignore file itself. Which was not a problem as long as I was not tracking the .gitignore file. But at some point I committed the .gitignore file itself. This then led to the .gitignore file being properly ignored.

    So adding one more line fixed it:

    /*
    !/content/
    !.gitignore
    

提交回复
热议问题