Here is error when i use git add .
$ git add .
error: short read while indexing .editorconfig
error: .editorconfig: failed to insert into database
error: unable to index file '.editorconfig'
fatal: adding files failed
How can i fix it?
In my case the folder was on a Mac, stored in iCloud & also being backed up via git. The File API sometimes removes files from disk. I opened the folder in Finder and clicked the download button, then it worked.
This (error: short read while indexing name
) happens when Git finds a file of the given name, gets information from the OS about that file, and goes to add that file to the index aka staging-area. Git:
On Git-for-Windows when using WSL, there's a new feature whereby you can allow the system to store two files that differ only in the case of some names, e.g., both readme.txt
and README.TXT
. Normally Windows only allows one such name, and once the name exists, using any variant—including ReAdMe.TxT
or reaDME.tXT
or whatever—gets you the one file. Git-for-Windows makes too much use of this assumption, which WSL has now broken.
The solution for now is:
Eventually, the Git-for-Windows folks will build a version of Git-for-Windows that handles the problem.
1The macOS folks may snicker at the Windows folks here, but macOS has similar issues. In some ways the macOS issues can be worse (NFC vs NFD names), though in other ways the Windows issues are worse (can't create files named aux.c
and aux.h
). Git needs a proper general mechanism here, really, but in some ways this is an unsolvable problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With