我们正在尝试使用svn2git实用程序(https://github.com/nirvdrum/svn2git)从svn迁移到git。这个实用程序似乎每次都失败,错误如下。如果有人看到同样的错误或有更好的选择,请分享。
命令
svn2git https://xyz.xyz.com/svn/svnrepo/ --verbose --authors authors.txt
控制台输出

Running command: git svn init --prefix=svn/ --no-metadata --trunk='trunk' --tags
='tags' --branches='branches' https://xyz.xyz.com/svn/svnrepo/
Running command: git config --local --get user.name
Running command: git config --local svn.authorsfile authors.txt
Running command: git svn fetch
Running command: git branch -l --no-color
Running command: git branch -r --no-color
Running command: git config --local --get user.name
Running command: git config --local --get user.email
Running command: git checkout -f master
error: pathspec 'master' did not match any file(s) known to git.
command failed:
git checkout -f master

另外,我的SVN回购网址也正确,就在后备箱上方。我正在Win7 64位计算机上尝试此操作。
谢谢!

最佳答案

很晚了,但有人可能还需要这个。我设法找到了issue #241。长话短说,windows不理解脚本添加到'命令的参数周围的单引号(git)。可能有多种方法可以修复它,但我只是手动破解了migration.rb文件,即以下代码片段:

    cmd += "--trunk=#{trunk} " unless trunk.nil?
    unless tags.nil?
      # Fill default tags here so that they can be filtered later
      tags = ['tags'] if tags.empty?
      # Process default or user-supplied tags
      tags.each do |tag|
        cmd += "--tags=#{tag} "
      end
    end
    unless branches.nil?
      # Fill default branches here so that they can be filtered later
      branches = ['branches'] if branches.empty?
      # Process default or user-supplied branches
      branches.each do |branch|
        cmd += "--branches=#{branch} "
      end
    end

注意,在#{trunk}#{tag}#{branch}周围不再有引号。这就成功了。

08-27 04:33