另一个 git 进程似乎正在运行,因此无法提交
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40449342/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Another git process seems to be running and thus cant commit
提问by Ayush Mahajan
I was committing my git process and thought that it would be okay if I ignore comments so I used this code
我正在提交我的 git 进程,并认为如果我忽略注释就可以了,所以我使用了这段代码
git commit filename
Bash was strange and thus i closed the console now when I use proper command
Bash 很奇怪,因此当我使用正确的命令时,我现在关闭了控制台
git commit -m"THIRD COMMIT" filename
It give the following response:
它给出以下响应:
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:
另一个 git 进程似乎正在这个存储库中运行,例如一个由“git commit”打开的编辑器。请确保所有进程都已终止,然后重试。如果它仍然失败,则该存储库中的 git 进程可能较早崩溃了:
what should I do?
我该怎么办?
回答by liuguangsen0409
I met this problem recently too.
我最近也遇到了这个问题。
rm -f ./.git/index.lock
try this commend in your git bash, then you can solve your problem.
在你的 git bash 中试试这个推荐,然后你就可以解决你的问题。
回答by Gersee
Removing the index.lock
like it was recommended in this answer of another questionshould solve your problem.
删除另一个问题的这个答案中index.lock
建议的类似内容应该可以解决您的问题。
回答by devendra
- In windows, change settings to view hidden folders
- Navigate inside .git folder
- Manually delete .lock file
- 在 Windows 中,更改设置以查看隐藏文件夹
- 在 .git 文件夹中导航
- 手动删除 .lock 文件
回答by dush88c
It happened for me when I run pull from GIT command and got conflicts and try to revert them by the TortoiseGIT client. I resolved this by running below code at root folder level of my repo
当我从 GIT 命令运行 pull 并遇到冲突并尝试通过 TortoiseGIT 客户端恢复它们时,它发生在我身上。我通过在我的 repo 的根文件夹级别运行以下代码解决了这个问题
rm .git/index.lock
Hope this is helpful.
希望这是有帮助的。
回答by user8526130
This helps to avoid the below message "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 进程似乎正在此存储库中运行,例如由 'git commit' 打开的编辑器。请确保所有进程都已终止,然后重试。如果仍然失败,则 git 进程可能有早些时候在此存储库中崩溃:手动删除文件以继续。”
Even in windows when I tried deleting the index.lock file, the git reset --hard HEAD command was executing without any hindrance.
即使在 Windows 中,当我尝试删除 index.lock 文件时, git reset --hard HEAD 命令也可以毫无障碍地执行。
del index.lock git reset --hard HEAD
del index.lock git reset --hard HEAD
Previously when I was running the checkout process inside this repository , I had to disconnect in middle of the process. So this might be the cause for this issue.
以前,当我在此存储库中运行结帐流程时,我不得不在流程中间断开连接。所以这可能是这个问题的原因。
回答by Rokan Nashp
I have same faced issues when i tried to staged file in SourceTree.
当我尝试在SourceTree 中暂存文件时,我遇到了同样的问题。
To solve this go to the .gitfolder in the project directoryand manually delete index.lockand you are done.
要解决此问题,请转到项目目录中的.git文件夹并手动删除index.lock 即可。
回答by Nathan Sodja
The commands didn't seem to work for me so I navigated to the root folder of my project, viewed hidden files, then navigated to .git/ to delete index.lock, I rerun git commit -m"THIRD COMMIT" filename and that was it!
这些命令似乎对我不起作用,所以我导航到项目的根文件夹,查看隐藏文件,然后导航到 .git/ 以删除 index.lock,我重新运行 git commit -m"THIRD COMMIT" filename 和是吗!
回答by Salih Kiraz
check .gitignore files . When I tried to find the error I found and fixed it.
检查 .gitignore 文件。当我试图找到错误时,我发现并修复了它。