Another git process seems to be running in this repository

Git 操作的过程中突然出现以下错误:

1
2
3
4
5
Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.

翻译过来就是 Git 被另外一个程序占用,重启机器也不能够解决。

原因在于 Git 在使用过程中遭遇了奔溃,部分被上锁资源没有被释放导致的。

解决方法:进入项目文件夹下的 .git 文件中删除 index.lock 文件即可。