当我尝试提交时存在gitindex.lock文件,但不能删除该文件

  • 回答 (2)
  • 关注 (0)
  • 查看 (27)

当我做“GIT提交”时,我得到以下信息:

fatal: Unable to create 'project_path/.git/index.lock': File exists.

但是,当我做的时候ls project_path/.git/index.lock意思是文件不存在。对我该做什么有什么想法吗?我也注意到了这个项目_path/.git属于root,不确定这是否与我遇到的问题有关。

Git版本为1.7.5.4

倩倩威武倩倩威武提问于
ywojb10T一声不吭 慢慢窒息回答于

Windows:

  • 从作为admin打开的Powershell控制台中,尝试

rm-f./.git/index.lock

  • 如果这不起作用,则必须杀死所有git.exe进程。
SUCCESS: The process "git.exe" with PID 20448 has been terminated.
SUCCESS: The process "git.exe" with PID 11312 has been terminated.
SUCCESS: The process "git.exe" with PID 23868 has been terminated.
SUCCESS: The process "git.exe" with PID 27496 has been terminated.
SUCCESS: The process "git.exe" with PID 33480 has been terminated.
SUCCESS: The process "git.exe" with PID 28036 has been terminated.
> rm -f ./.git/index.lock
1008396我是来点赞的回答于

这可能是一个旧的答复,但我希望这是更有用的下一个谁需要这个解决方案。

在linux/unix/gitbash/cygwin上,尝试

rm -f .git/index.lock

在Windows命令提示符下,尝试:

del .git\index.lock

希望这有帮助,我在这里找到了这个解决方案:Fatal: Unable to create ‘…git/index.lock’ File exists

扫码关注云+社区