.gitignore is ignored by Git

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

    I had this problem, with a .gitignore file containing this line:

    lib/ext/
    

    I just realized that in fact, this directory is a symbolic link to a folder somewhere else:

    ls -la lib/ext/
    lrwxr-xr-x 1 roipoussiere users 47 Feb  6 14:16 lib/ext -> /home/roipoussiere/real/path/to/the/lib
    

    On the line lib/ext/, Git actually looks for a folder, but a symbolic link is a file, so my lib folder is not ignored.

    I fixed this by replacing lib/ext/ by lib/ext in my .gitignore file.

提交回复
热议问题