svn迁移到gitlab

yum install -y git-svn

如果想保留提交记录,可以用下面的命令找到:

[root@centos3 bbs]# svn log --xml | grep author | sort -u | perl -pe 's/.>(.?)<./$1 = /'
<author>guoxiong</author>
<author>liujiangbu</author>

修改格式:

guoxiong = guoxiong  <guoxiong@qq.com>
liujiangbu = liujiangbu  <liujiangbu@qq.com>

从svn上clone出要迁移的项目:

[root@centos3 bbs-bak]# git svn clone  svn://svn.tttttt.com:9600/bbs/  --no-metadata  --authors-file=users.txt^C
[root@centos3 bbs-bak]# ll
total 8
drwxr-xr-x. 14 root root 4096 Aug 29 17:11 bbs
-rw-r--r--.  1 root root   84 Aug 29 17:11 users.txt

[root@centos3 bbs-bak]# cd  bbs
[root@centos3 bbs]# git remote add origin git@10.40.2.74:soa/bbs.git
[root@centos3 bbs]# git push origin --all
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

[root@centos3 bbs]# vim .git/config

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[svn-remote "svn"]
        noMetadata = 1
        url = svn://svn.hqygou.com:9600/bbs
        fetch = :refs/remotes/git-svn
[svn]
        authorsfile = /home/bbs-bak/users.txt
[remote "origin"]                                            #要是没有这两段要加上
        url = http://10.40.2.22/soa/bbs.git       

然后去gitlab上创建改项目:


image.png
[root@centos3 bbs]# git push origin --all
Username for 'http://10.40.2.22': root
Password for 'http://root@10.40.2.74': 
Counting objects: 2349, done.
Compressing objects: 100% (2241/2241), done.
Writing objects: 100% (2349/2349), 5.84 MiB | 3.53 MiB/s, done.
Total 2349 (delta 485), reused 0 (delta 0)
remote: Resolving deltas: 100% (485/485), done.
To http://10.40.2.22/soa/bbs.git
 * [new branch]      master -> master

查看是否迁移成功:

image.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,222评论 19 139
  • 源代码管理工具的起源 为什么会出现源代码管理工具? 为了解决在软件开发过程中,由源代码引发的各种蛋疼繁琐问题 源代...
    小白文_Vincent阅读 3,226评论 2 8
  • 总去猜疑这什么 忘却了自己的实体 这样很自卑 你早晚要放下 好好睡觉吧
    待解救的傻子阅读 170评论 0 0
  • 0 飞机起飞时,仁川已经入夜了。 闵玧其透过窗,看到在这个会飞的小箱子底下,路灯和霓虹黏在一起,黏成华夫饼的网格,...
    802cc71a0ccf阅读 249评论 0 0
  • 原文摘录: 如果你总是为了工作而熬夜或者牺牲周末时光,其实并不是因为你有很多工作要做,而是因为你的工作状态不佳。而...
    嗑瓜子的晓鸣阅读 423评论 0 0