我试图学习如何使用Git,并创建了一个带有HTML, CSS和JavaScript文件的小项目。我从我的基本空项目做了一个分支,然后对我的代码做了一些更改。我尝试进行临时更改,但我得到以下错误消息:

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 Bash,因为我不知道如何摆脱我以某种方式得到的。

是否有办法解决这个问题,或者我应该开始一个新的存储库?


当前回答

我也面临同样的问题。我需要做更多的工作来解决这个问题。

首先,我删除了文件索引。锁,然后我从现有的Git存储库位置克隆了新的代码。我在不同的地方修改了代码。我复制了.git文件夹和.gitignore文件文件,并粘贴到我所做的代码更改的代码文件夹中。

然后我试着承诺和推动,结果很顺利。 如果你的问题没有以上给出的解决方案,这些信息可能会有帮助。

其他回答

如果你不幸使用了你的git或git remove从git总线,或者你不能提交你的代码和“git add .”并远程上传代码,那么请检查以下内容。

这个命令… 假设您的错误类型

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总线或Windows PowerShell 然后使用下面的命令 rm . / index.lock

我在更新吊舱时得到了这个错误。我通过删除索引来解决这个问题。将文件锁定在cocoapods的.git目录中。

rm -f /Users/my_user_name/.cocoapods/repos/master/.git/index.lock

它可能会帮助某些人。

除了删除。Git文件夹中的锁文件外,如果你正在使用Visual Studio Code和Git Graph扩展,请尝试卸载它,然后重新安装。它应该能解决这个问题。

在这里输入图像描述 如果这是你的情况,那么很容易解决。该问题将通过以下步骤解决。

在您工作的文件夹中输入Git的隐藏文件夹。 删除”指数。锁”文件 使用“git status”命令查看git状态 如果你的文件没有提交,你必须使用“git add——all”命令提交你的文件 再次检查git状态,执行文件并提交

做得好!我希望你已经解决了这个问题。

这对我很管用。我得到了同样的错误。

删除HEAD。Windows 10上的“lock”文件。现在我可以在远程上提交和推送我的更改。