458.【Git】解决:E:/**/.git/index.loc

2022-10-15  本文已影响0人  七镜

今天提交代码时遇到了一个问题,导致我提交不了代码到gitlab上,报错如下所示:

            19:59   Commit failed with error
            0 file committed, 4 files failed to commit: after guoqing
            Unable to create 'E:/company/workspace_database/update_jar/.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.

遇到这个问题,直接去把 E:/company/workspace_database/update_jar/.git/index.lock 删了,就解决了。其实这是 git 为了避免多进程同时提交上的一个锁。和linux里,我们使用 vim 编辑器时,会自动生成一个.swap文件一样的。

可见,原理都一样,但换了个场景,就不知道咋回事了,值得反思。

上一篇 下一篇

猜你喜欢

热点阅读