将代码从自己搭的SVN私服转到Bitbucket私服

自己用VPS搭了个SVN私服,存了以前写的小项目,因为这些代码好久没有动过了,万一哪一天忘记了,代码就丢失了,还是在Bitbucket上存一下好了,反正Bitbucket上面私服免费且不限量。

直接用SVN export会丢失历史check in 记录,查到svn to git migration教程,不是很复杂,记录如下:

参考英文教程:https://www.atlassian.com/git/tutorials/migrating-prepare

1.下载附助工具 svn-migration-scripts.jar 并检查环境

java -jar ~/svn-migration-scripts.jar verify

2.创建1G大小的大小写敏感的文件系统

java -jar ~/svn-migration-scripts.jar create-disk-image 1 GitMigration

3.获取用用户信息数据并转换

cd ~/GitMigration

java -jar ~/svn-migration-scripts.jar authors <svn-repo> > authors.txt

生成authors文件如下:

j.doe = j.doe <j.doe@mycompany.com>

m.smith = m.smith <m.smith@mycompany.com>

改成用户名和邮件形式

j.doe = John Doe <john.doe@atlassian.com>

m.smith = Mary Smith <mary.smith@atlassian.com>

示例如下:

java -jar ~/svn-migration-scripts.jar authors http://www.wuliang.org/svn > authors.txt

ericxu = ericxu <ericxu@mycompany.com>
ghw = ghw <ghw@mycompany.com>
wuliang = wuliang <wuliang@mycompany.com>
zhangyusu = zhangyusu <zhangyusu@mycompany.com>
zhujiaye = zhujiaye <zhujiaye@mycompany.com>
 

4.转化标准SVN目录结构项目(有 trunk,branches,tags标准目录)

git svn clone --stdlayout --authors-file=authors.txt <svn-repo>/<project> <git-repo-name>

示例如下:

git svn clone --stdlayout --authors-file=authors.txt http://www.wuliang.org/svn/rayblog/ rayblog

说明:rayblog下有(trunk,branches,tags目录)

5.转化非标准SVN目录结构项目

git svn clone --trunk=/trunk --branches=/branches --branches=/bugfixes --tags=/tags --authors-file=authors.txt <svn-repo>/<project> <git-repo-name>

示例如下:

git svn clone --trunk=/weather-client --authors-file=authors.txt http://www.wuliang.org/svn/ weather-client

说明:此项目没有trunk,branches,tags目录,项目代码就在http://www.wuliang.org/svn/weather-client 下面。如果命令为 [git svn clone --trunk=/weather-client --authors-file=authors.txt http://www.wuliang.org/svn/weather-client weather-client ] 因路径不对,拿不到代码也不会报错(我第一次便遇到这个问题)

6.目录清理/转换(清理trunk,branches,tags,转换成git的tag)

检查模式,不会正真操作,会告知操作改变,加上(-forece)为真正执行操作

java -Dfile.encoding=utf-8 -jar ~/svn-migration-scripts.jar clean-git

java -Dfile.encoding=utf-8 -jar ~/svn-migration-scripts.jar clean-git --force

7.Git代码上传

cd rayblog

git remote add origin https://wulliam@bitbucket.org/wulliam/rayblog.git

git push -u origin --all

转载于:https://my.oschina.net/u/111684/blog/746844

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值