Git gives input/output error on staging. unable to write loose object file

Viewed 491

I am getting this error when I try to stage my changes. Couldn't find anything on the internet. I faced this same issue before so did a reclone and the issue got fixed for a while. But got it again after a few days. Any possible fixes or reasons why it's happening?

 ❯ git add .
    error: file write error: Input/output error
    fatal: unable to write loose object file
1 Answers

Generally, the error EIO, which is generally rendered as "Input/output error", means that your file system or hardware is having a problem. A healthy file system should never produce this error.

If you're on Linux, you should look at dmesg to see what the error from the kernel is and take appropriate action. That could be an fsck or a replacement of the defective drive. On other systems, either read the kernel logs or invoke a suitable tool (e.g., Disk Utility on macOS) to find out what's wrong.

This isn't specific to Git; you'll probably see it in other applications as well.

Related