V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
thinkershare
V2EX  ›  问与答

Git 仓库,总是出现一个奇怪的错误: .git/index.lock File exists., 是什么故障呢?

  •  
  •   thinkershare · Jan 24, 2024 · 1127 views
    This topic created in 837 days ago, the information mentioned may be changed or developed.

    我有一个 Git 仓库,同步到了 GitHub 和和自建的 GitLab 上,这个仓库最近频繁的在多台电脑上出现相同的错误:

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

    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.

    我已经尝试将仓库删除,重新 clone ,在不同的机器上,这个问题还是仿佛出现,每次删除掉 index.lock 提交成功,并 pull/push 后,下次使用 vscode 编辑代码后,再次 commit,又会出现一样的错误。

    3 replies    2024-01-24 17:30:48 +08:00
    whileFalse
        1
    whileFalse  
       Jan 24, 2024 via Android
    可能是两个 git 在同时操作这个 repo ,比如 vscode 插件自动刷新的时候你手动 commit
    XXWHCA
        2
    XXWHCA  
       Jan 24, 2024
    盲猜装了多个 git
    thinkershare
        3
    thinkershare  
    OP
       Jan 24, 2024
    @whileFalse
    主要是就这一个仓库有问题,奇了怪了。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4033 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 04:20 · PVG 12:20 · LAX 21:20 · JFK 00:20
    ♥ Do have faith in what you're doing.