我试图学习如何使用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 repo上 并行

但他们不应该这么跑

所以固定了自动化 去除掉复杂的东西

其他回答

在应用程序的根目录中使用以下命令。这将删除索引。锁定文件并释放活动锁。

rm .git/index.lock

好的,我最终通过运行'git rm .git/index.lock'来让它工作…

这很奇怪,因为我以前这么做过几次都没有用,但是嘿,电脑,对吧?

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

首先,运行

rm -f .git/index.lock

然后运行

git reset --hard

在命令提示符或Git Bash中。

它可能正在发生,你的分支已损坏,创建新的分支 Git分支#检查分支。我已经创建了一个新的分支并在工作。

branch -b "main"
git checkout -b "main"  #main is new branch
git add .
git commit -m "all files"
git remote add origin #**YOUR REPO**  https://github.com/tarun-techmarbles/wp-dump-sql-git-push.git
git push origin main  #push with new branch