.gitignore is ignored by Git

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

    I noticed that the encoding of the .gitignore was having an effect--if the file was Unicode, it was ignored, if it was ASCII, it wasn't.

    Process:

    1. Verify status: PS> git status
    2. Create a function to Get-FileEncoding
    3. Test .gitignore's encoding: PS> Get-FileEncoding .gitignore
    4. Change the encoding to ASCII: PS> Set-Content .gitignore -Encoding Ascii -Value (Get-Content .gitignore)
    5. Confirm: PS> git status

提交回复
热议问题