error bad signature 0x00000000

error: bad signature 0x00000000

问题描述

今天在写git commit的时候,电脑突然蓝屏了,重启后输入git status显示如下错误信息

1
2
3
4
lan@DESKTOP-8ISAT6B MINGW64 /e/Blog/blogRoot (src)
$ git status
error: bad signature 0x00000000
fatal: index file corrupt

解决方案

先删除index

1
rm -f .git/index

然后再重新创建index

1
git reset

运行效果:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
lan@DESKTOP-8ISAT6B MINGW64 /e/Blog/blogRoot (src)
$ rm -f .git/index

lan@DESKTOP-8ISAT6B MINGW64 /e/Blog/blogRoot (src)
$ git reset
Unstaged changes after reset:
M source/lover/index.md
M source/todo/index.md

lan@DESKTOP-8ISAT6B MINGW64 /e/Blog/blogRoot (src)
$ git status
On branch src
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: source/lover/index.md
modified: source/todo/index.md

no changes added to commit (use "git add" and/or "git commit -a")

参考资料

https://www.cnblogs.com/linga/p/10214955.html
https://www.jianshu.com/p/58f306f0b8c5