用了比较长时间的 SVN,但现在新的项目都采用Git。之前的项目又不得不维护,那么能不能将项目从SVN迁移到Git呢。答案是肯定的,网上的方案是 git-svn,或者更高级的封装 svn2git。

方法其实很明确,导出SVN的历史数据,建立新的Git Repo。但是在实际操作中遇到了一些问题,且在这里记录一下。这次的操作环境是Windows。

1. git-svn只支持通过网络连接(svn:// 或 http://之类)的方式来转换

这样的话,其实比较麻烦,需要提供网络形式的连接方式。一些小项目就是本地建的repo。

git.exe svn clone "file:///D:/Repositories/thirdparty"  "F:\Working\CXX\thirdparty-test" -T trunk -b branches -t tags

Initialized empty Git repository in f:/Working/CXX/thirdparty-test/.git/
Couldn't open a repository: Unable to open an ra_local session to URL: Unable to open repository 'file:///D:/Repositories/thirdparty': Expected FS format '2'; found format '4' at /usr/lib/perl5/site_perl/Git/SVN.pm line 310 git did not exit cleanly (exit code 1) (2344 ms @ 2013/8/17 10:11:08)

  

2. 利用TortoiseSVN自带的svnserve.exe来提供svn://连接方式

D:\Repositories>"E:\Progs\TortoiseSVN\bin\svnserve.exe" -t -r D:\Repositories
( success ( 2 2 ( ) ( edit-pipeline svndiff1 absent-entries commit-revprops depth log-revprops atomic-revprops partial-replay ) ) )
D:\Repositories>"E:\Progs\TortoiseSVN\bin\svnserve.exe" -i -r D:\Repositories
( success ( 2 2 ( ) ( edit-pipeline svndiff1 absent-entries commit-revprops depth log-revprops atomic-revprops partial-replay ) ) ) D:\Repositories>"E:\Progs\TortoiseSVN\bin\svnserve.exe" -i --listen-port 3690 -r D:\Repositories
( success ( 2 2 ( ) ( edit-pipeline svndiff1 absent-entries commit-revprops depth log-revprops atomic-revprops partial-replay ) ) )
D:\Repositories>"E:\Progs\TortoiseSVN\bin\svnserve.exe" -i --listen-port 13690 -r D:\Repositories
( success ( 2 2 ( ) ( edit-pipeline svndiff1 absent-entries commit-revprops depth log-revprops atomic-revprops partial-replay ) ) )
D:\Repositories>"E:\Progs\TortoiseSVN\bin\svnserve.exe" -d --listen-port 13690 -r D:\Repositories

之前一直连不上,出现下面的错误:

svn Connection refused at /usr/lib/perl5/site_perl/Git/SVN.pm line 310

利用-d选项后,可以实现正常访问。

3. 转换之后,可以将这个repo推到仓库中。

参考链接:

https://code.google.com/p/support/wiki/ConvertingSvnToGit

How to Convert Subversion Repo to Git的更多相关文章

  1. convert svn repo to git

    https://john.albin.net/git/convert-subversion-to-git 1. 抓取Log 在linux 上做的,其余是在win上做的. 2. svn co svn:/ ...

  2. repo 和git的用法

    1. 服务器版本下载: repo init -u git@192.168.1.11:i700t_60501010/platform/manifest.git-b froyo_almond -m M76 ...

  3. repo+manifests+git方式管理安卓代码

    repo+manifests+git方式管理安卓代码 1.repo的获取 repo只是google用Python脚本写的调用git的一个脚本,主要是用来下载.管理Android项目的软件仓库.(也就是 ...

  4. 发布 Rafy 源码到 GitHub

      最近项目组开始使用 Git 来作为源码管理.我今天就顺便把 Rafy 的源码也迁移到了 github 上,方便大家使用.这是项目的地址:https://github.com/zgynhqf/raf ...

  5. Git - Tutorial [Lars Vogel]

    From: http://www.vogella.com/tutorials/Git/article.html Git - Tutorial Lars Vogel Version 5.6 Copyri ...

  6. Git - Tutorial官方【转】

    转自:http://www.vogella.com/tutorials/Git/article.html#git_rename_branch Lars Vogel Version 5.8 Copyri ...

  7. Subversion/Git/ReviewBoard工作流程

    根据My (work)Git Workflow进行修改,在 Windows下进行测试,http://mojodna.net/2009/02/24/my-work-git-workflow.html 目 ...

  8. How to get started with GIT and work with GIT Remote Repo

    https://www.ntu.edu.sg/home/ehchua/programming/howto/Git_HowTo.html#zz-7. 1.  Introduction GIT is a ...

  9. gitlab & gerrit & git & repo & jenkins

    Omnibus GitLab documentation(中文安装说明) 在自己的服务器上部署 GitLab 社区版->较为全面 GIT & REPO & GERRIT (三) ...

随机推荐

  1. 昨日尝试使用百度死链提交,使用lCGI规则提交

    本来打算去掉北盟网校的死链,但就算配了规则,提交百度,但是好像还是没有删除到 认真阅读了百度的死链工具 好像需要将死链返回404错误提示 检查北盟的代码,发现北盟做了404从定向 在程序里面404从定 ...

  2. mac OSX 上 brew install hive

    本文介绍brew install hive并修改默认的metastore存储方案,改Derby数据库为mysql的方法以及可能遇到的问题的解决方案. 1. 通过homebrew安装hive 1 bre ...

  3. php - 执行Linux命令没有报错但也没有输出

    今天我需要在同事访问我的PHP页面的时候执行一段python脚本,于是我的代码是这样写的: 1 <?php 2 function my_workjob(){ 3 $this->makeLo ...

  4. tldr 的安卓客户端

    上次在 Cheat (tldr, bropages) - Unix命令用法备忘单 这篇博文中提到过 tldr ,它跟 cheatsheet 的功能一样:用来查询一些常用命令的惯用法,呈现形式是简明扼要 ...

  5. Mac mongodb 配置安装

    简单总结就几条,比较简单配置mongodb. 1,首先下载安装包:百度云下载地址 2,下载之后解压到自己常放的工作目录下,然后开始配置一下你的Mac环境 vim ~/.bash_profile 添加m ...

  6. 一种线程安全的handle

    对象引用的正确性在多线程环境下是一个复杂的问题,请参考,处理由引用计数引起的泄漏.简单来说,我们应该尽量减少使用强引用,否则将有可能产生[处理由引用计数引起的泄漏]一文中描述的难以察觉的内存泄漏问题. ...

  7. 安卓Android面试题大全

    56个问题都是经常用到的,可以深入研究下,也是必须掌握的开发必备知识. 安卓Android面试题汇总 搜集了一些Android面试题目,供将要面试或者正在面试的朋友参考. 1, 谈谈你对Activit ...

  8. 构建基于WinRT的WP8.1 App 02:数据绑定新特性

    基于WinRT的Windows Phone 8.1以及Windows 8.1中Xaml数据绑定增加了一些新特性. FallBackValue属性:FallBackValue在绑定的值属性值不存在时,可 ...

  9. Microsoft 2013 新技术学习笔记 四

    在继续学习Model的实践经验之前,先思考一下Controller和View的实践原则在本次系统重构中的应用,我手上是一个后台管理系统(不是门户系统.不是具体业务系统),通俗点讲就是给企业的运维人员用 ...

  10. WindowsServer2012桌面图标设置

    1.win+R调出运行窗口 2.输入:rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,0 即可