PHP中文网2017-05-02 09:21:26
.gitignore 文件应该位于您的存储库中,因此确实应该添加并提交它,正如 git status 所建议的那样。它必须是存储库树的一部分,以便可以合并对它的更改等等。
所以,将其添加到您的存储库中,它不应该被 gitignored。
如果你确实想要,如果你不想提交它,可以将 .gitignore 添加到 .gitignore 文件中。但是,在这种情况下,最好将忽略添加到 .git/info/exclude,这是一个特殊的签出本地文件,其工作方式与 .gitignore 类似,但不会显示在“git status”中,因为它位于 .git 文件夹中。
另请参阅 https://help.github.com/articles/ignoring-files
注以下文字信息来自http://stackoverflow.com/questions/767147/ignore-the-gitignore-file-it...八月的回答。