1 问题引入
在正常使用git进行push代码时,突然失败了, 再次push代码,报如下错误:
Unable to create D: /workspace/Xxx/git/index. lock: File exists.Another git process seems to be running in this repository, e. gan editor opened by git commit. Please make sure all processtryit still fails, a git processmay have crashed in this repository earlieremove the mle manually to continue.
翻译结果:
无法创建D:/workspace/Xxx/git/index。lock:文件存在。另一个git进程似乎正在这个存储库中运行,即git提交打开的e.gan编辑器。请确保所有进程仍然失败,git进程可能在此存储库中提前崩溃,请手动删除mle以继续。
2 问题说明
Git 执行操作时会自动生成 index.lock 文件,操作结束后会自动删除, 上锁的主要是为了避免同时操作同一个文件夹。
3 解决方法
找到对应的.git目录层级, 删除掉相关的index.lock文件.
如果电脑隐藏了文件, 可通过下述操作查看:
1 双击我的电脑(此电脑)
2 最左侧上方有三个选项: 文件(默认) 计算机 查看
3 点击查看, 找到 隐藏的项目 勾选即可