使用subgit进行svn迁移至git(branch,tags)
前言:
最近公司需要将整体项目从svn迁移至gitlab上,经过几天的研究,现记录一下流程
整体思路是进行一次导入:
先通过subgit将svn整个import至本地,在与git上的项目进行合并.
1.硬件环境
git:git version 2.7.4
svn: 1.6.11
subgit:3.2.2
2.下载subgit
官网下载subgit: https://subgit.com/
将subgit解压:
tar -zcvf subgit-3.2..zip
3.在gitlab上新建一个需要合并的项目
进入gitlab管理界面,新建项目:lclctest
git@xx.xx.xx.xx:lclc/lclctest.git (我这边新建了一个lclc的组)
建好以备用.
4.进入subgit-3.2.2/bin 目录,使用configure命令
./subgit configure http://ip:port/svn/lclctest lclctest
完成后会有一些提示:
) Adjust Subversion to Git branches mapping if necessary:
/root/lclctmp/tmp/subgit-3.2./bin/lclctest/subgit/config
) Define at least one Subversion credentials in default SubGit passwd file at:
/root/lclctmp/tmp/subgit-3.2./bin/lclctest/subgit/passwd
OR configure SSH or SSL credentials in the [auth] section of:
/root/lclctmp/tmp/subgit-3.2./bin/lclctest/subgit/config
) Optionally, add custom authors mapping to the authors.txt file(s) at:
/root/lclctmp/tmp/subgit-3.2./bin/lclctest/subgit/authors.txt
) Run SubGit 'install' command:
subgit install lclctest
意思是进行一些配置,然后进行install
配置config:由于3.2.2默认是配置好的,可以不进行配置
trunk = trunk:refs/heads/master
branches = branches/*:refs/heads/*
branches = branches/features/*:refs/heads/features/*
branches = hotfixes/*:refs/heads/hotfixes/*
tags = tags/*:refs/tags/*
shelves = shelves/*:refs/shelves/*
配置用户映射文件 author.txt 格式为:svnUser = Git User <user@example.com> (也可以不修改)
5.进行install
$ ./subgit install lclctest
此步将连接svn,需要耗时一段时间.
完成后就把svn代码迁移到本地库了,这时候就需要用git push到远程库中
6.clone版本
git clone ./lclctest lclctest.git
7.进入lclctest.git目录
git remote set-url origin git@yourip:lclc/lclctest.git(之前创建的git项目)
git push origin master
在push的时候发现提示填写密码:
git@ip's password:
此时说明需要进行身份验证,我们给git添加一个keygen就行了
7.1:生成keygen
cd ~
ssh-keygen -t rsa -C "your_email@example.com"
生成的文件在 .ssh文件下有 id_rsa和id_rsa.pub文件
7.2:上传keygen
打开gitlab的管理界面

将id_rsa.pub文件中的内容复制到Key的文本框里.
再执行步骤7的git push origin master命令上传master
8.上传分支.
进入lclctest.git目录,使用命令查看分支
git branch -a
结果:
* master
remotes/origin/HEAD -> origin/master
remotes/origin/bugfix
remotes/origin/develop
remotes/origin/feature
remotes/origin/master
本项目一共有3个分支,分别是bugfix,develop,feature,分别进行上传
git push origin remotes/origin/feature:refs/heads/feature
git push origin remotes/origin/bugfix:refs/heads/bugfix
git push origin remotes/origin/develop:refs/heads/develop
注意:冒号后面为远程库中的地址,必须以refs/heads开头.
9.上传tags
git push --tags
参考资料:
http://lattecake.com/post/20051
http://stackoverflow.com/questions/23251394/subgit-import-and-multiple-branches-directories
使用subgit进行svn迁移至git(branch,tags)的更多相关文章
- SVN迁移到Git的过程(+ 一些技巧)
SVN迁移到Git的过程(+ 一些技巧) 李顺利 Key Words SVN,Git,Clone,Conversion,Tips,VCS,Pro Git 关于在VCS中SVN和Git之间的迁移(Clo ...
- SVN迁移到Git的过程(+ 一些技巧
关于在VCS中SVN和Git之间的迁移(Clone)这个部分网上已经有大批的文章介绍,而且都非常不错,能够满足我们的常见的需求,这里介绍的是我自己整理的一些技巧和使用中出现的一些问题和疑问.阅读本篇文 ...
- svn迁移到git仓库并保留commit历史记录
svn迁移到git仓库并保留commit历史记录 最近在做svn迁移到gitlab,由于之前一直是由svn做版本控制.最简单的方式是将svn的内容export出来,然后添加到gitlab即可.但是,如 ...
- svn 迁移至git操作手册
svn 迁移至git操作手册 项目交付.版本管理工具变更等情况下,迁移svn旧历史记录有很大必要,方便后续追踪文件的提交历史,文件修改记录比对等.git自带了从svn迁移至git的工具命令,可很好的对 ...
- git学习------>从SVN迁移到Git之后,项目开发代码继续在SVN提交,如何同步迁移之后继续在SVN提交的代码到Git?
最近逐步逐步的将公司的项目都从SVN往Git迁移了,但是想团队成员都能够一步到位就迁移到Git是不可能的,因为还有大部分人都还不会Git,所以整个过渡过程估计得大半年. 因此导致虽然项目迁移过来了,但 ...
- 将代码库从 SVN 迁移至 Git 并保留所有 commit 记录
公司内部原本使用 SVN 进行版本控制,但随着 Github 的流行我个人的代码管理习惯逐渐转变.虽然公司项目并非开源,SVN 所具有的标准 trunk / branches / tags 结构完全够 ...
- svn迁移到git
步骤命令如下: > git svn clone https://svn-url/ProjectName --no-metadata --authors-file=user.txt --trunk ...
- 从svn迁移至Git并保留所有 commit 记录
用户映射文件user.txt,等号左边为svn账号,右边为Git用户名和邮箱.注意:svn中有多少用户就要映射多少 test1=test1<147258369@qq.com>test2=t ...
- svn 迁移到 git 仓库并保留 commit 历史记录
1.svn 转换为 git(会提示,让你输入先前 svn 的账号与密码) # 切换至 本地项目目录 cd /Users/jianbao/PhpStormProjects/fiisoo/ # 克隆 sv ...
随机推荐
- PHP环境的搭建及与nginx的集成
1. 去php官网下载最新稳定版(最新其实是7.0,为了兼容性,使用5.6.16) wget http://cn2.php.net/get/php-5.6.16.tar.gz/from/this/m ...
- linux系统编程之信号(三):信号安装、signal、kill,arise讲解
一,信号安装 如果进程要处理某一信号,那么就要在进程中安装该信号.安装信号主要用来确定信号值及进程针对该信号值的动作之间的映射关系,即进程将要处理哪个信号:该信号被传递给进程时,将执行何种操作. li ...
- ovs 源mac, 目的src 互换
push:NXM_OF_ETH_SRC[],push:NXM_OF_ETH_DST[],pop:NXM_OF_ETH_SRC[],pop:NXM_OF_ETH_DST[] 1:把src mac推到栈顶 ...
- Flask系列03--Flask的路由 app.route中的参数, 动态参数路由
Flask–路由 添加路由的两种方式 第一种 @app.route("/my_de") def detail() 第二种(了解即可) app.add_url_rule(" ...
- django框架项目 国际化和本地化的实现方法
转自 https://blog.csdn.net/scissors0707/article/details/79042458 Django国际化 所谓的国际化,是指使用不同语言的用户在访问同一个网站页 ...
- jzoj5347
tj:80pts:維護f[i][j]表示當前第i個方塊必須選,且選了j個的最優解,設w[i]為第i個方塊長度 則可以枚舉上次選了第k個方塊,則f[i][j]=max{f[k][j-1]+w[i]*(i ...
- Hash Table-720. Longest Word in Dictionary
Given a list of strings words representing an English Dictionary, find the longest word in words tha ...
- Flask从入门到精通之Jinja2模板引擎
我们使用一个简单的例子切入到Jinja2模板引擎,形式最简单的Jinja2模板引擎就是一个包含响应文本的文件,实例如下: <h1>Hello World!</h1> 最简单的包 ...
- mysql导入数据错误
ERROR 29 (HY000): File '/tmp/cun' not found (Errcode: 13) # sudo /etc/init.d/apparmor reload(重新加载) 大 ...
- day 56 linux的安装python3 ,虚拟环境,mysql ,redis
1.1下载python源码包 网址:https://www.python.org/downloads/release/python-366/ 下载地址:https://www.python.org/f ...