Reputation: 413
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?
Upvotes: 3
Views: 5039
Reputation: 1
In my case I had this file NUL in my project folder, that could not be moved or deleted or read at all. It is like kind of bug.
When I tried to move the file NUL It showed error like internal failure number 8x????
I replicate my project folder without the file NUL
Then the failure with git add . is gone
Upvotes: 0
Reputation: 7444
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.
Upvotes: 3
Reputation: 20473
Upvotes: 0
Reputation: 488453
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.
Upvotes: 4