Git SVN 错误:一个 Git 进程之前在存储库中崩溃了

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9185053/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 12:55:36  来源:igfitidea点击:

Git SVN error: a Git process crashed in the repository earlier

gitgit-svn

提问by Pinchas K

I was just trying to commit changes to the Git master. From what I have read, it seems that the idea is to delete the lock file. The message says:

我只是想将更改提交给 Git 主控。从我读过的内容来看,这个想法似乎是删除锁定文件。消息说:

make sure no other Git processes are running and remove the file manually

确保没有其他 Git 进程正在运行并手动删除文件

Perhaps someone knows, which file to remove and how to remove?

也许有人知道,要删除哪个文件以及如何删除?

回答by Schwern

The file in question is likely .git/index.lockand it should be safe to just remove it if you have no other git processes running. Make sure a git-svn command isn't hanging.

有问题的文件很可能.git/index.lock如果您没有其他 git 进程正在运行,只需将其删除应该是安全的。确保 git-svn 命令没有挂起。

PS My usual approach to fixing git-svn problems is to make a fresh pull of the repository. Time consuming, but you can do it in parallel with trying to fix the problem. Have a little race between you and git. Of course, this only works if you didn't have unpushed commits.

PS 我修复 git-svn 问题的常用方法是重新拉取存储库。耗时,但您可以在尝试解决问题的同时进行。在你和 git 之间来一场小竞赛。当然,这仅在您没有未推送的提交时才有效。

回答by Joel

Removing the index.lockfile like Schwern stated will solve this problem.

index.lock像 Schwern 所说的那样删除文件将解决这个问题。

You can remove it by running rm -f ./.git/index.lock

您可以通过运行删除它 rm -f ./.git/index.lock

The rmcommand is used to remove (delete) files and directories.

rm命令用于移除(删除)文件和目录。

The -fstands for force which tells your computer to remove the files without prompting for confirmation

-f代表力告诉您的计算机中删除文件时不提示进行确认

回答by user3981082

For "GUI" user like me

对于像我这样的“GUI”用户

Open Git Extension and choose repository (if more than one) Choose "Settings" from top menu then "Git Maintenance" and then click on "Delete Index Lock"

打开 Git 扩展并选择存储库(如果有多个)从顶部菜单中选择“设置”,然后选择“Git 维护”,然后单击“删除索引锁”

Git Extensions: Settings->Git Maintenance->Delete Index Lock

Git 扩展:设置->Git 维护->删除索引锁

回答by Andrew Denysyuk

You have already opened a commit in another tab in the terminal

您已经在终端的另一个选项卡中打开了一个提交

回答by artegen

It may also concern any *.lock files in .git/

它也可能涉及 .git/ 中的任何 *.lock 文件

Check and remove them. You may use: rm -f ./.git/*.lock

检查并删除它们。您可以使用:rm -f ./.git/*.lock

回答by Joyce obi

The answer giving by @Joel helped, except that for windows users you may have to enable show hidden files/folders to access .gitfolder where index.lockfile exist. Use this link in case you don't know how to enable hidden folders.

@Joel 给出的答案有所帮助,除了对于 Windows 用户,您可能必须启用显示隐藏文件/文件夹才能访问index.lock文件所在的.git文件夹。 如果您不知道如何启用隐藏文件夹,请使用此链接。

回答by sarangan

Removing the index.lock file like Schwern stated will solve this problem.

删除像 Schwern 所说的 index.lock 文件将解决这个问题。

You can remove it by running rm -f ./.git/index.lock

您可以通过运行 rm -f ./.git/index.lock 删除它

The rm command is used to remove (delete) files and directories.

rm 命令用于移除(删除)文件和目录。

The -f stands for force which tells your computer to remove the files without prompting for confirmation

-f 代表强制,它告诉您的计算机删除文件而不提示确认

still not working means open the git through git bash instead of doing in terminal

仍然无法正常工作意味着通过 git bash 打开 git 而不是在终端中进行