如何解决 git-svn 索引不匹配的问题?
当我执行 git svn rebase 时,它在某一点停止说:
索引不匹配:一棵树的 SHA 密钥!=另一棵树的 SHA 密钥。
(我开始知道这些 SHA 密钥对应于一棵树而不是来自 git show 的上述两个 sha 键的提交。)
re-reading <sha index of a commit in svn/trunk>
... list of files ...
fatal: bad object <SHA1 index of the bad object>
rev-list -1 <SHA1 index of the bad object> --not <SHA1 index of the revision it was trying to re-read>: command returned error: 128
我对 git 的内部工作经验不是很丰富,那么是否有一系列步骤可以遵循来剖析此类问题并可能解决它们?
When I did a git svn rebase it stopped at one point saying:
Index mismatch: SHA key of a tree != SHA key of another tree.
(I come to know that these SHA keys corresponds to a tree and not a commit from git show of the above two sha keys.)
re-reading <sha index of a commit in svn/trunk>
... list of files ...
fatal: bad object <SHA1 index of the bad object>
rev-list -1 <SHA1 index of the bad object> --not <SHA1 index of the revision it was trying to re-read>: command returned error: 128
I am not very experienced in the internal workings of git, so is there a sequence of steps to follow to dissect problems like these and possibly resolve them?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(10)
请不要删除 .git/svn 文件夹来修复此问题。它要求您重建所有内容,这很烦人,需要一段时间(对于我的存储库的大小而言需要几个小时),而且没有必要。
我在这里找到了正确的答案我已将其包含在下面。
从链接:
在 .git 目录中运行以下命令:
现在从第一个命令的输出中删除匹配的 .svn/.caches
现在
git svn rebase
或git svn fetch
随心所欲。Please don't remove the .git/svn folder to fix this. It requires you to rebuild everything, it is annoying, it will take awhile (for the size of my repo several hours) and it is NOT NECESSARY.
I found the right answer here and I've included it below.
From the link:
Inside the .git directory run the following:
Now delete the matching .svn/.caches from the output of the first command
Now
git svn rebase
orgit svn fetch
to your heart's content.我已经遇到过两次此错误,两次都通过删除 .git 文件夹内的 svn 文件夹来解决它。
重建 svn 元数据:
您可能会看到一条消息:
然后用以下命令
I've had this error twice and both times resolved it by removing the svn folder inside the .git folder.
then rebuild the svn metadata with:
You will probably see a message along the lines of:
and after while (rebuilding can take a while especially on large repositories) you should end up with a working mirror of the svn repository again.
更新 git 客户端并使用以下命令重新获取最后的 svn 提交:
其中 12345 是现有的 svn 修订版。
Update git client and refetch last svn commits using:
where 12345 is existing svn revision.
就我而言,该问题是由新的/未知的 svn 作者引起的,他不在我的 git-svn 配置使用的
authors
文件中。它在输出中报告说,我忽略了前几个读取:因此,这给了我丢失的名称,以及要添加的文件(我从组织用户注册表中提取了电子邮件),一切顺利。
In my case, the issue was caused by a new/unknown svn author who was not in my
authors
file that git-svn was configured to use. It reported it in the output that that I ignored the first few reads:So that gave me the name that I was missing, and what file to add it too (I pulled the email from my organizations user registry) and was smooth sailing.
问题是,在这种情况下,你必须系统地执行此操作:
缺少一些东西,一切崩溃。我知道恢复的唯一方法是删除 .git 中的所有 svn 并重建所有内容。这只是烦人并且需要一段时间!
The problem there is that you have to do this systematically in this case :
Something missing, everything crash. The only way I know to recover is do remove all svn in .git and rebuild everything. It's just annoying and take a while !
很可能,您的消息中也可能同时存在校验和不匹配:
我在这里找到了解决方案 Git svn变基:校验和不匹配:
Likely, you may also have Checksum mismatch at the same time in your message:
I found solution here Git svn rebase : checksum mismatch:
我自己刚刚遇到了这个错误。只需删除引用,如下所示:
这应该会清除错误。
I just had this error myself. Just delete the ref, like so:
That should clear up the error.
也许与文件系统(ext4/btrfs/etc...)的写时复制功能有关?
请参阅:https://stackoverflow.com/a/42299634/7491491
Maybe something to do with Copy-On-Write feature of your filesystem (ext4/btrfs/etc...) ?
See : https://stackoverflow.com/a/42299634/7491491
我收到此错误:
索引不匹配:!= <煞>;;中找不到(r)
重新读取
...文件列表...
<路径>在提交
在 SVN 存储库中查看报告路径的历史记录,我找到了添加该文件的 SVN 修订版。但在 Git 中查看为该修订创建的提交时,我发现它不包含任何文件!
我认为这是由之前的磁盘已满引起的。在执行 git svn reset -r 回到损坏的 Git 提交的修订版本后,git svn fetch 再次正常工作。
I got this error:
Index mismatch: <sha> != <sha>
re-reading <sha index of a commit in svn/trunk>
... list of files ...
<path> was not found in commit <sha> (r<svn rev>)
Looking in SVN repo at the history of the reported path, I found the SVN revision where the file had been added. But looking in Git at the commit created for that revision I found that it didn't contain any files!
I think this had been caused by a full disk earlier. After doing a
git svn reset -r
back to the revision of the broken Git commit,git svn fetch
worked fine again.我在最初的克隆过程中遇到了这个问题,结果有人创建了一个名为 trunk 的分支,它与真正的主干冲突。忽略 /branches/trunk 后一切正常
I ran into this during the initial cloning turns out someone created a branch called trunk which conflicted with the real trunk. After ignoring /branches/trunk all worked