用了比较长时间的 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. 【国内独家首发】iPhone4 iOS7不完美越狱教程新鲜出炉

    准备工作: 1.Mac (OSX 10.8以上系统): 2.iPhone 4 (iPhone3, 1 iOS 7.0.2): 3.iPhone 4数据线一根: 4.下载越狱工具包:ios7_jb_ki ...

  2. SSD硬盘 全盘安全擦除

    此文From http://ssd.zol.com.cn/575/5753057.html 在SSD固态硬盘的使用过程中,部分用户可能会碰到计算机意外掉电或死机并强行断电后,系统出现异常,扫描SSD后 ...

  3. 转:ecshop商品分类页获取相册列表方法

    ecshop商品分类页获取相册列表方法 很久之前就看到过你好在商品列表页有获取到相册列表,但是一直没有实践过,感觉应该挺简单的吧,但是最近手上的项目刚好就需要这个功能,然后就想到网上查下资料,至少找个 ...

  4. iPhone私有API

    一.基本知识 iPhone中的API除了公开的API:Published API外(或者叫文档中记录的API:Documented API),还有两类API:私有API:Private API和未公开 ...

  5. [Unit Testing] AngularJS Unit Testing - Karma

    Install Karam: npm install -g karma npm install -g karma-cli Init Karam: karma init First test: 1. A ...

  6. kwm备忘

    brew install homebrew/binary/kwm ==> Tapping homebrew/binary Cloning into '/usr/local/Library/Tap ...

  7. 让VS2010/VS2012添加新类时自动添加public关键字

    在VS添加类别的时候,每次都需要添加public关键字,表示好麻烦. 但是可以避免这个麻烦的. 通过修改VS2010的ItemTemplate,可以避免这个麻烦. 修改方法如下: 1. 打开文件夹Mi ...

  8. jquery $.proxy使用

    在某些情况下,我们调用Javascript函数时候,this指针并不一定是我们所期望的那个.例如: //正常的this使用 $('#myElement').click(function() { // ...

  9. Shooting Algorithm

    Shooting算法是Wenjiang提出的一种优化Lasso(L1 Regularization)和Bridge Regression的算法, 本文以Lasso为例. 对于线性回归问题$\mathb ...

  10. Touch Event

    转自:      http://hi.baidu.com/masaiui/item/971775e8b316238bc10d754b 参考: http://hedgehogking.com/?p=55 ...