【error】git提交代码报错

错误信息1

Unable to create ‘C:/Java/System/.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.
在这里插入图片描述

问题分析

Git 执行操作时会自动生成 index.lock 文件,操作结束后会自动删除。这样做的目的是避免同时操作同一个文件夹。

解决方法

打开项目所在文件夹,进入 .git/目录,删除index.lock文件,然后重新提交。
在这里插入图片描述

错误信息2

在这里插入图片描述

解决方案

按下图操作后重新提交。
在这里插入图片描述
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_43622777/article/details/130586794
今日推荐