将git分支镜像到svn repo



我正在寻找一种设置现有git存储库(从Atlassian存储库上托管的中央存储库克隆而来)的方法,以便将特定分支的更改同步到SVN存储库上的路径。我对从SVN取回更改或同步分支和标记不是特别感兴趣;我只想有一个SVN"镜像"我的一个分支。

在阅读了git-svn手册页和其他各种来源后,我甚至用git-svn-init设置了svn-repo,但它将拒绝dcommit任何内容:

$ git --version
git version 1.9.5.msysgit.0
$ git clone ssh://git@stash-server.mydomain.com:4321/myproject/playground.git
Cloning into 'playground'...
$ cd playground
$ svn mkdir --parents https://svn-server.mydomain.com:5432/svn/playground/trunk -m "Importing git repo" 
Committed revision 15900.
$ git svn init https://svn-server.mydomain.com:5432/svn/playground/trunk
$ git svn fetch
W: Ignoring error from SVN, path probably does not exist: (175007): HTTP Path Not Found: REPORT request failed on '/svn/145273/!svn/bc/100/playground/trunk': '/svn/145273/!svn/bc/100/playground/trunk' path not found
W: Do not be alarmed at the above message git-svn is just searching aggressively for old history.
This may take a while on large repositories
r15900 = 1ad941791edb06c4df8281cd31e69ce5d508e728 (refs/remotes/git-svn)
$ git svn dcommit
Unable to determine upstream SVN information from HEAD history.
Perhaps the repository is empty. at C:Program Files (x86)Git/libexec/git-coregit-svn line 856.

"也许存储库是空的"->当然是,我正试图将一个git分支"克隆"到svn中。知道我在这里做错了什么吗?

您可能想要查看Atlassian Stash的SubGit及其插件。它巧妙地处理了在转换时将Git镜像到SVN的问题。

披露:我为Atlassian 工作

在此处找到答案:http://eikke.com/importing-a-git-tree-into-a-subversion-repository/

这失败了,因为git-svn命令无法确定要推送的提交:我们的原始git存储库和Subversion头之间没有链接。

为了解决这个问题,我们可以使用Git移植来链接它们。我们将告诉Git,创建SVN文件夹的提交是Git存储库中第一个提交的父提交:

$ git show-ref trunk
741ab63aea786882eafd38dc74369e651f554c9c refs/remotes/trunk
$ git log --pretty=oneline master | tail -n1
88464cfdf549a82b30ee7c52e53e2b310f0d9ec4 Initial version
$ echo "88464cfdf549a82b30ee7c52e53e2b310f0d9ec4 741ab63aea786882eafd38dc74369e651f554c9c" >> .git/info/grafts

最新更新