簡體   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