在Git中commit一个新文件有时会fail并给出如下提示:
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在上次使用中遭遇崩溃,部分被上锁资源没有释放。
解决方案
1.将项目文件夹下的 .git文件夹中的index.lock文件删除即可(需要显示隐藏文件,.git是隐藏文件夹)
2.直接在Git中输入命令行:rm .git/index.lock