Why is 'Updating the Git index failed' displayed

前端 未结 3 688
谎友^
谎友^ 2021-01-30 10:30

I am using Windows. When staging files I get this error.

Updating the Git index failed. A rescan will be automatically started to resynchronize git-gui.

3条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-30 11:15

    I also ran into this even tho my core.autocrlf setting is already false and core.safecrlf is unset. I suspect the culprit is the config setting diff.astextplain.textconv.

    When I ran git config --list, the following line was shown in the output:

    diff.astextplain.textconv=astextplain
    

    I don't think this setting is actually related to the warning/error but it inspired me to look into text conversion that might be being done. After a little spelunking online and in my repo, I discovered the following line in my repo's .gitattributes file:

    * text=auto
    

    [I probably got the .gitattributes file from GitHub.]

    Given that only the above line was un-commented in it, and further that dealing with 'automagic' line-ending conversions has always been a headache, I opted to remove that file from my repo. After doing so, staging the same files no longer prompted me with the "Updating the Git index failed" warning/error.

提交回复
热议问题