lock文件不断重新出现

lock文件不断重新出现

本文介绍了.git/index.lock文件不断重新出现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试运行任何git命令时,我得到以下信息

When I try to run any git command, I get the following

$ git add .
 fatal: Unable to create 'J:/Project/geospatial/U5M_africa/.git/index.lock': File exists.

 If no other git process is currently running, this probably means a
 git process crashed in this repository earlier. Make sure no other git
 process is running and remove the file manually to continue.

我删除了文件,没有任何错误:

I remove the file without any errors:

$ rm -f .git/index.lock

我也尝试在Windows中手动删除它.该文件消失,但立即重新出现.如果我尝试执行任何git命令,仍然会遇到同样的致命错误.

I also try to remove this manually in windows. The file disappears, but re-appears immediately. If I try any git commands I still get the same fatal error.

是什么导致文件立即重新出现?我该如何彻底摆脱它,过上我的生活?

What is causing the file to instantly re-appear? How can I get rid of it for good and get on with my life?

推荐答案

我的解决方法不是那么优雅,但有效:

My not so elegant, but effective solution:

首先重命名文件,然后将其删除.出于某种原因,这行得通..

Rename the file first, then delete it. For some reason, this works ..

这篇关于.git/index.lock文件不断重新出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 07:04