Git文件操作失败并提示Another git process seems to be running in this repository, e.g. an editor opened by ...

在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

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容