我正在按照以下步骤操作: http://git-scm.com/book/en/v2/Git-and-Other-Systems-Git-as-a-Client
将 svn 存储库移动到 git。我本地的svn版本是:
$ svn --version
svn,版本 1.8.10 (r1615264)
2014 年 8 月 25 日,10:52:18 在 x86_64-apple-darwin12.5.0 上编译
git 版本:
$ git --version
git 版本 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?
最佳答案
我在 git-users 电子邮件列表中得到了答复。
解决办法是在本地运行一个svnserver,在运行git svn clone
时使用svn
协议(protocol),而不是file
协议(protocol)。这避免了 git-svn
需要解析 svn 1.8 文件格式。
假设您的存储库位于目录 /path/to/repository/test-svn
中。切换到 /tmp
目录并运行
svnserve -d -r /path/to/repository
然后就可以运行了
git svn clone svn://127.0.0.1/test-svn -s
然后,停止 svnserver 并删除临时 svn 存储库。
关于git svn 迁移失败,svn 1.8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27240428/