我们正在尝试使用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回购URL也是正确的,它就在后备箱的上方。我正在Win7 64位机上试用这个。
发布于 2018-03-18 15:41:11
晚了,但可能有人还需要这个。我设法追踪到第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注意,#{trunk}、#{tag}和#{branch}不再有引号。这招成功了。
发布于 2016-12-19 21:36:55
有很多叫做svn2git的工具,最好的工具可能是来自https://github.com/svn-all-fast-export/svn2git的KDE工具。我强烈建议使用该svn2git工具。这是我所知道的最好的,而且它非常灵活,您可以使用它的规则文件。
您使用的svn2git工具是基于git-svn和git-svn的,而不是,这是存储库或存储库部分一次性转换的合适工具。如果您想使用Git作为现有SVN服务器的前端,这是一个很好的工具,但是对于一次性转换,您应该使用而不是使用git-svn,而是更适合这种用例的svn2git。
如果您对存储库的历史没有100%的了解,那么svneverever来自http://blog.hartwork.org/?p=763是一个很好的工具,可以在将它迁移到Git时研究它的历史。
尽管git-svn (或者在您的例子中是错误的svn2git )更容易开始,但以下是使用KDE svn2git而不是git-svn的更好的原因,除了它的灵活性:
svn2git重建得更好、更干净(如果使用正确的历史),尤其是对于具有分支和合并等更复杂历史的历史。git-svn时,标记包含额外的空提交,这也使得它们不属于分支,所以在将--tags交给命令之前,普通的fetch不会得到它们,因为在默认情况下,也只获取指向获取分支的标记。使用适当的svn2git标记是它们所属的位置svn2git配置这个布局,而使用git-svn,您最终会丢失历史记录。svn2git,您还可以轻松地将一个SVN存储库拆分为多个Git存储库。svn2git转换比使用git-svn快很多倍。git-svn更差、KDE svn2git更优越的原因有很多。:-)
发布于 2019-01-18 16:41:40
没有多少“答案”,但这是解决我的问题的办法。顺便说一句,来自svn2git的错误消息真的没有帮助。
我获得完全相同错误的原因是,在执行初始导入时,我没有使用主干的完整路径。
SVN回购的结构如下:
https://example.com/folderA/projectName
- trunk
- tags
- ...我运行svn2git时只有svn2git https://example.com/folderA --username ...。
当我还将"/projectName“包含到回购路径时,我执行了以下操作:
svn2git https://example.com/folderA/projectName --username ...
...all工作得很好。另外,在重试之前,我从以前的尝试中删除了现有的.git文件夹。
https://stackoverflow.com/questions/41230248
复制相似问题