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

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

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

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

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

但是,当我做的时候ls project_path/.git/index.lock意思是文件不存在。

提问于
用户回答回答于

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
用户回答回答于

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

rm -f .git/index.lock

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

del .git\index.lock

扫码关注云+社区