2014-12-02 101 views
10

失敗,我在下面的步驟: http://git-scm.com/book/en/v2/Git-and-Other-Systems-Git-as-a-Client混帳SVN遷移與SVN 1.8

移動一個SVN庫與git。我的本地SVN版本是:

$ svn --version svn, version 1.8.10 (r1615264) compiled Aug 25 2014, 10:52:18 on x86_64-apple-darwin12.5.0

Git版本:

$ git --version git version 2.1.0

當我克隆庫我得到一個錯誤讀取本地文件系統格式:

$ git svn clone file:///tmp/test-svn -s 
Initialized empty Git repository in /private/tmp/test-svn/.git/ 
Couldn't open a repository: Unable to connect to a repository at URL 'file:///tmp/test-svn': Unable to open an ra_local session to URL: Unable to open repository 'file:///tmp/test-svn': Expected FS format between '1' and '4'; found format '6' at /usr/local/Cellar/git/2.1.0/lib/perl5/site_perl/Git/SVN.pm line 310 

根據svn發佈的說明,FS格式6在svn 1.8中引入: http://subversion.apache.org/docs/release-notes/1.8.html#revprop-packing

難道是git 2.1 Perl腳本還不兼容這個svn版本嗎?更重要的是,我怎樣才能讓這個svn庫轉換成git?

+0

我試着將git升級到最新版本2.2並仍然得到相同的錯誤。 – saschwarz 2014-12-02 03:47:38

回答

17

我在git-users電子郵件列表上找到了答案。

解決方案是在運行'git svn clone'而不是'file'協議時運行本地svnserver並使用'svn'協議。這避免了git-svn需要解析svn 1.8文件格式。

因此,我更改爲/tmp目錄並運行svnserve -d。 我當時能夠git svn clone svn://127.0.0.1/test-svn -s,它完美無缺。然後我停止了svnserver並刪除了臨時的svn倉庫。

+0

請問您可以寫一個帶'svnserve'命令行和'ssh:// ...'的路徑的例子嗎? – Kromster 2015-03-21 10:31:38

+8

'cd'到'test-svn'的父目錄(或者你的SVN回購被稱爲 - 我正在使用這個例子)。然後運行'svnserve -d --foreground -r .'。您的repo網址現在是'svn:// localhost/test-svn'。 – 2015-05-22 14:48:15

+0

在你的回答中不應該是'svn://'而不是'ssh://'? – 2016-01-14 23:45:13