.gitignore is ignored by Git

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

    One thing to also look at: Are you saving your .gitignore file with the correct line endings?

    Windows:

    If you're using it on Windows, are you saving it with Windows line endings? Not all programs will do this by default; Notepad++ and many PHP editors default to Linux line endings so the files will be server compatible. One easy way to check this, is open the file in Windows Notepad. If everything appears on one line, then the file was saved with Linux line endings.

    Linux:

    If you are having trouble with the file working in a Linux environment, open the file in an editor such as Emacs or nano. If you see any non-printable characters, then the file was saved with Windows line endings.

提交回复
热议问题