简体   繁体   English

将subversion存储库转换为git,为什么我看到“致命:不是有效的对象名称”?

[英]Converting a subversion repository to git, why am I seeing “fatal: not a valid object name”?

I am seeing the following output while converting a subversion repo to git. 我在将subversion repo转换为git时看到了以下输出。

> Found possible branch point: <repo-url>/trunk => <repo-url>/branches/CMT_PHASE3, 18441
> fatal: Not a valid object name refs/remotes/BlueSimViewer 5.0 20110316 Branch
> cat-file commit refs/remotes/BlueSimViewer 5.0 20110316 Branch: command returned error: 128

The command I am running to convert the repo is 我正在运行以转换回购的命令是

> git svn clone <repo-url> -A authors-transform.txt --stdlayout converted-git > svnlog

This process has already converted 117 branches, some with spaces in their names. 此过程已经转换了117个分支,其中一些分支中包含空格。 I first found this SO question , which helped me move forward from a previous issue solved by git 1.8.xx 我首先发现了这个问题 ,这帮助我从git 1.8.xx解决的上一个问题向前推进

Any insight as to the cause of this problem and possible ways of fixing it are greatly appreciated. 任何关于这个问题的原因以及修复它的可能方法的见解都非常感谢。

I am running git version 1.8.1.1 on an Ubuntu 12.10 server. 我在Ubuntu 12.10服务器上运行git版本1.8.1.1。 I am happy to provide any other information that would be helpful. 我很乐意提供任何其他有用的信息。

I found a solution, but I am not satisfied with the result. 我找到了解决方案,但我对结果不满意。 If someone can provide a way to do this without ignoring the problematic branches, then I am happy to accept his or her answer. 如果有人能够提供一种方法来做到这一点而不忽视有问题的分支,那么我很乐意接受他或她的回答。

For each branch/tag that throws this error, open the following file 对于抛出此错误的每个分支/标记,请打开以下文件

git-repo-name/.git/packged-refs

and place a pound symbol (#) at the start of the line containing the offending branch/tag. 并在包含违规分支/标记的行的开头放置一个井号(#)。

For example, with respect to my question 例如,就我的问题而言

b88c4df0d47a9ca43c2d0ffd4a1f6e471f98aebc refs/remotes/BlueSimViewer%205.0%2020110316%20Branch

becomes

#b88c4df0d47a9ca43c2d0ffd4a1f6e471f98aebc refs/remotes/BlueSimViewer%205.0%2020110316%20Branch

This marks the line as a comment, and git will continue the conversion process while ignoring the problematic branch. 这将该行标记为注释,git将继续转换过程,同时忽略有问题的分支。

I am still converting at the time of writing this answer. 在写这个答案的时候我还在转换。 Although this solution means some branches are missed, at least I will know what branches aren't there. 虽然这个解决方案意味着错过了一些分支,但至少我会知道哪些分支不存在。

Might be too late now but I guess I found a, at least, odd solution. 现在可能为时已晚,但我想我发现了一个至少是奇怪的解决方案。

Open the file git-repo-name/.git/packged-refs that you mentioned and replace the %20 for spaces, save the document and try again. 打开您提到的文件git-repo-name/.git/packged-refs并将%20替换为空格,保存文档git-repo-name/.git/packged-refs试。 Worked for me. 为我工作。

Edited in Notepad++ with UTF-8. 使用UTF-8在Notepad ++中编辑。

Git version: git version 2.6.2.windows.1 (win 7 64x via git bash). Git版本: git version 2.6.2.windows.1 (通过git bash赢得7 64x)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM