本文介绍了如何将平面svn存储库迁移到git repo的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个扁平的svn存储库,看起来像:

I have a flat svn repository which looks like:

my_repo/
├── file1.c
├── file2.c
├── file3.c
└── README

此存储库没有分支或标签,我要做的就是将其转换为git存储库并维护提交历史记录.

This repo has no branches, or tags and all I am trying to do is convert it to a git repository and maintain the commit history.

我尝试过:

git svn clone --trunk=/ -A users.txt svn+ssh://[email protected]/projects/my_repo dest_dir

我以为可以工作,但是,当我导航到dest_dir并执行git svn fetch时,似乎并没有获取任何东西.使用git log产生:

Which I assumed would work, however, when I navigate into dest_dir and perform git svn fetch, it doesn't seem to fetch anything. Using git log yields:

fatal: bad default revision 'HEAD'

如果我使用svn checkout svn+ssh://[email protected]/projects/my_repo它返回:

A    my_repo/file1.c
A    my_repo/file2.c
A    my_repo/file3.c
A    my_repo/README
Checked out revision 57.

因此存储库是活动的并且可以访问.

So the repository is alive and accessible.

我尝试了包括subgit在内的各种工具,该工具给了我这个错误:svn: E170003: 'stat' not implemented,我认为这是因为托管存储库的服务器正在使用旧版本的Subversion.我无法控制服务器,因此无法执行更新.

I have tried various tools including subgit which was giving me this error: svn: E170003: 'stat' not implemented and I think this is because the server hosting the repository is using an old version of subversion. I have no control over the server so cannot perform an update.

我还尝试通过命令使用svn2git

I have also tried using the svn2git, using the command

svn2git svn+ssh://[email protected]/projects/my_repo --rootistrunk -authors users.txt --verbose

但这给了我另一个错误:

but this was giving me another error:

E: 'svn+ssh:/[email protected]/projects/my_repo' is not a complete URL and a separate URL is not specified command failed

这让我感到难过,我也不知道为什么它不起作用.基本上,我想知道如何在保持历史记录的同时将我的svn存储库转换为git存储库.希望有人可以帮助我,或为我指明正确的方向.从未意识到将这个简单的仓库转移到git会如此困难!

This stumped me, and I've no idea why it's not working. Basically I was wondering how I go about turning my svn repo into a git repo while maintaining the history. Hope someone can help me out, or point me in the right direction. Never realised it would be so difficult to transfer this simple repo to git!

谢谢

推荐答案

问题出在svn2git--rootistrunk参数上.相反,请尝试以下操作:

The problem is with svn2git's --rootistrunk argument. Instead of that, try this:

svn2git svn+ssh://[email protected]/projects/my_repo --trunk / --notags --nobranches --authors users.txt --verbose

这篇关于如何将平面svn存储库迁移到git repo的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 23:31