无法提交 – ‘.git/index.lock’:文件已存在。尽管实际上并没有这样的文件。

huangapple go评论58阅读模式
英文:

Can't commit - '.git/index.lock': File exists. Even though, there is no file like that

问题

在尝试提交和推送时出现错误:

似乎在此存储库中有另一个 Git 进程正在运行,例如由 'git commit' 打开的编辑器。请确保所有进程已终止,然后再试一次。如果仍然失败,可能是此存储库中的 Git 进程之前崩溃了:请手动删除文件以继续。

我尝试过的方法:

  1. 查找并删除该文件 - 在此存储库中没有名为 index.lock 的文件。它不存在,既不在 .git 文件夹中,也不在 git/refs/head/my_branch 中(是的,显示了隐藏文件,是的,我尝试过使用 sudo)。
  2. 完全删除存储库,然后再次克隆它,然后提交。
  3. 终止所有 Git 进程。
  4. 强制重启计算机。
  5. 删除 .git/COMMIT_EDITMSG - 没有这样的文件。

没有结果。

英文:

Getting an error when trying to commit and push:

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.

What I tried:

  1. finding that file and deleting it - there is no file index.lock in this repo. It is not there, neither in the .git folder nor in git/refs/head/my_branch (yes, hidden files are shown, yes I tried through sudo).
  2. completely delete the repo and clone it once again, and then committing.
  3. kill all of the git processes.
  4. hard reset of computer.
  5. rm .git/COMMIT_EDITMSG - no such file

No result.

答案1

得分: 1

错误与问题的真正原因无关。花时间与我根本不应该“战斗”的东西,哈哈。

我执行了ga . & gcmsg "updated" && gp,而不是ga . && gcmsg "updated" && gp。可能对某人有帮助。

英文:

the error has nothing to do with the real cause of the problem. Spend time "fighting" with what I am not suppose to "fight" at all, lol.

I did ga . & gcmsg "updated" && gp instead of ga . && gcmsg "updated" && gp 🤣

Maybe will be helpful for someone.

huangapple
  • 本文由 发表于 2023年2月9日 03:25:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/75390794.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定