.gitignore is ignored by Git

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

    In my case, it's because the files already exist in the repository and I'm trying to ignore it.

    These are the things I did to fix the issue:

    • Copy the files to a temporary folder
    • Remove them from my project folder.
    • Commit the changes which remove those files from the repository
    • Re-added those files to my project folder

    By then, any changes I made on those files were ignored.

    I think you can't ignore files that already exist on the repository.

提交回复
热议问题