繁体   English   中英

将git分支镜像到svn repo

[英]Mirror git branch to svn repo

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

在阅读了git-svn手册页和其他各种资源之后,我得到了使用git svn init设置svn repo的知识,但是它将拒绝提交任何内容:

$ 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-core\git-svn line 856.

“也许存储库是空的”->当然是,我正在尝试将git分支“克隆”到svn中。 知道我在做什么错吗?

您可能想查看SubGit及其Atlassian Stash的附加组件。 过渡时,它将巧妙地将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

暂无
暂无

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

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