avatar

IDEA中对代码进行commit时,git报Unable to create 'E/blog/.git/index.lock' File exists问题解决

异常信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Commit failed with errors
0 file committed, 13 files failed to commit: 2020102214:11:13
Unable to create 'E:/blog/.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.
Unable to create 'E:/blog/.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.

解决方法

方法一

在文件的根目录下按住Shift键后右键点击空白处,点击在此处打开Powershell窗口(S),输入以下命令即可

在此处打开Powershell窗口(S)

1
rm .git/index.lock

完成

方法二

使用命令提示符在项目的根目录下输入以下命令即可

1
del .git\index.lock

完成

方法三

进入项目的根目录下,勾选查看下隐藏的项目,双击进入.git文件夹中

.git文件夹

找到并删除index.lock文件即可

完成

文章作者: 123
文章链接: https://gao5805123.github.io/123/2020/10/22/IDEA%E4%B8%AD%E5%AF%B9%E4%BB%A3%E7%A0%81%E8%BF%9B%E8%A1%8Ccommit%E6%97%B6%EF%BC%8Cgit%E6%8A%A5Unable%20to%20create%20'E%20blog.gitindex.lock'%20File/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 123
打赏
  • 微信
    微信
  • 支付宝
    支付宝