.gitignore is ignored by Git

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

    One tricky thing not covered by the other answers here is that the .gitignore file won't work if you have inline comments, like this:

    foo/bar # The bar file contains sensitive data so we don't want to make this public
    

    So, if you do have comments like that, change them like this:

    # The bar file contains sensitive data so we don't want to make this public
    foo/bar
    

提交回复
热议问题