.gitignore is ignored by Git

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

    Another cause of this issue is blank spaces or tabs before the statement:

    Example:

    # Be aware of the following:
     notWorkingIgnore.*
    workingIgnore.*
    

    And as pointed out by the comment below a trailing space can be an issue as well:

    # Be aware of the following:
    notWorkingIgnore.* #<-Space
    workingIgnore.*#<-Nospace
    

提交回复
热议问题