2012-07-06 83 views
7

虽然做git svn clone -s https://svn.example.com/repo/我收到了以下的输出:混帐svn的克隆失败“致命的:不是有效的对象名称”

r3073 = a6132f3a937b632015e66d694250da9f606b8333 (refs/remotes/trunk) 
Found possible branch point: https://svn.example.com/repo/trunk => https://svn.example.com/repo/branches/v1.3, 3073 
W: Refspec glob conflict (ref: refs/remotes/trunk): 
expected path: repo/branches/trunk 
    real path: repo/trunk 
Continuing ahead with repo/trunk 
W: Refspec glob conflict (ref: refs/remotes/trunk): 
expected path: repo/branches/trunk 
    real path: repo/trunk 
Continuing ahead with repo/trunk 
W: Refspec glob conflict (ref: refs/remotes/trunk): 
expected path: repo/branches/trunk 
    real path: repo/trunk 
Continuing ahead with repo/trunk 
W: Refspec glob conflict (ref: refs/remotes/trunk): 
expected path: repo/branches/trunk 
    real path: repo/trunk 
Continuing ahead with repo/trunk 
fatal: Not a valid object name refs/remotes/tags/Sync Controllers 
cat-file commit refs/remotes/tags/Sync Controllers: command returned error: 128 

运行git branch -a给出:

remotes/tags/Sync%20Controllers 
remotes/tags/v1.1 
remotes/trunk 
remotes/v1.2 

我认为问题是, “遥控器/标签/同步控制器”!=“遥控器/标签/同步%20控制器”。

+0

另请参阅: https://bugs.launchpad.net/ubuntu/+source/git/+bug/786942 – kenorb 2012-07-19 11:03:49

+0

相关:http://stackoverflow.com/questions/7584605/git-svn-dcommit-因存储库名称包含空间而失败在那里有可用的补丁。 – kenorb 2012-10-26 08:25:30

回答

12

SVN上的标签中有一个空格,但git中的标签将此空间转换为%20(URL编码)。为了解决这个问题只需手动添加一个新的标签与逐字名称:

cd .git/refs/remotes/tags/ 
mv Sync%20Controllers Sync\ Controllers 

然后再次运行git svn clone命令。

(通常你应该这样做与git tag OLDTAG NEWTAG但混帐是不是让我来定义与空间的标签。标签文件是包含了有关提交的哈希值简单的文本文件。)

+2

然而,我试过这个解决方案,我得到以下错误: '致命的:引用具有无效的格式:'refs/remotes/tags/WITH SPACE''。如何解决这个问题? – 2014-06-25 07:28:40

+0

(我使用的是git 1.8.3.msysgit.0) – 2014-06-25 07:30:14

+0

这对我来说也是一个带有'〜'字符的标签。谢谢。 – Flimzy 2014-08-18 10:01:40

3

您可以使用git-svn服务器端替代方案SubGit以避免许多git-svn转换问题。

我是SubGit的开发者,可以说我们在解决像上面那样的字符翻译问题方面做了很多工作;在这种情况下,标签将被转换为refs/tags/Sync+Controllers标签。

请注意,git-svn已将Subversion标记翻译为分支而不是标记。

+0

我必须在服务器上安装SubGit或者它没有必要?如果我没有管理员访问我的svn回购怎么办? – kenorb 2012-10-26 08:24:21

+0

使用SubGit 2.0时,您不必具有对存储库的管理访问权限。您需要启用pre-revprop-change hook才能获得全功能的作者映射,但有可能已启用。查看http://subgit.com/eap/了解更多详情。 – 2012-11-16 17:35:16

0

我相信空间问题在Git> = 1.8.0(参见:#786942)中是固定的。

所以你应该升级它。

我测试过它,它似乎在最近的git版本中工作。

见GitHub的主页:https://github.com/git/git

+3

我使用1.8.5.2,跑进这个问题 – krinker 2014-09-12 13:54:50

+0

,做你认为这是关系到你的分支/标签名称的空间或一些特殊字符等? – kenorb 2014-09-12 14:10:17

+0

我已经使用Git = 1.8.3.1,SVN = 1.7.14和svn2git = 2.3.2 相关的各种SVN分支名称空间看到这个问题了。 – jplandrain 2015-11-16 15:11:16

1

我今天就遇到了这个问题,并认为这是分支,它包含了步伐,这并不重要,我只是跑

git branch -r -d partialPayment%202.4 

并重新运行git svn fetch 它跳过当前分支并继续抓取下一个分支。