git-svn clone失败"致命:不是有效的对象名称"

Ben*_*jie 11 git-svn

虽然git svn clone -s https://svn.example.com/repo/我收到了以下输出:

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
Run Code Online (Sandbox Code Playgroud)

跑步git branch -a给出:

remotes/tags/Sync%20Controllers
remotes/tags/v1.1
remotes/trunk
remotes/v1.2
Run Code Online (Sandbox Code Playgroud)

我认为问题是"遥控器/标签/同步控制器"!="遥控器/标签/同步%20控制器".

Ben*_*jie 19

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

cd .git/refs/remotes/tags/
mv Sync%20Controllers Sync\ Controllers
Run Code Online (Sandbox Code Playgroud)

然后git svn clone再次运行该命令.

(通常你会这样做,git tag OLDTAG NEWTAG但是git不允许我定义带有空格的标签.标签文件只是包含相关提交哈希值的文本文件.)

  • 我尝试了这个解决方案但是,我收到以下错误:`致命:引用的格式无效:'refs/remotes/tags/WITH SPACE'.怎么解决? (3认同)
  • 更新 .git/packged-refs 并用空格替换所有 %20 为我修复了它... git 2.18.0 (3认同)
  • 可能相同,但`cd .git/refs/heads /`或`cd .git/logs/refs/heads /`代替 (2认同)

Ale*_*aev 5

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

我是SubGit开发人员,可以说我们在解决上述字符转换问题上做了很多工作;在这种特殊情况下,标签将被翻译为refs/tags/Sync+Controllers标签。

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


小智 5

我今天遇到了这个问题,并认为这个包含速度的分支并不重要,我只是运行

git branch -r -d partialPayment%202.4
Run Code Online (Sandbox Code Playgroud)

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