git commit时,终端出现报错:

1
2
error: object file .git/objects/31/65329bb680e30595f242b7c4d8406ca63eeab0 is empty
fatal: loose object 3165329bb680e30595f242b7c4d8406ca63eeab0 (stored in .git/objects/31/65329bb680e30595f242b7c4d8406ca63eeab0) is corrupt

查询,定位原因是虚拟机崩溃导致的.git目录下文件的损坏。

解决方法如下:

https://stackoverflow.com/questions/11706215/how-to-fix-git-error-object-file-is-empty