参考文章Converting a Subversion repository to Githtml
cd ~/test_repo git svn clone file:///home/***/Desktop/SVN/svn_repo/ -T trunk -b branches -t tags
cd .. mkdir test.git cd test.git git init --bare
git symbolic-ref HEAD refs/heads/trunk
cd ~/test_repo git remote add bare ~/test.git git config remote.bare.push 'refs/remotes/*:refs/heads/*' git push bare
此时就完成了推送,能够删除test_repo了git
cd ~/test.git git branch -m trunk master
使用git svn clone导出版本库的时候会将svn中的tags保存成git中的tags/**,而并非默认的tag,因此要进行移动svn
cd ~/test.git git for-each-ref --format='%(refname)' refs/heads/tags | cut -d / -f 4 | while read ref do git tag "$ref" "refs/heads/tags/$ref"; git branch -D "tags/$ref"; done
进入工做文件夹,执行gitlab
git clone ~/test.git
使用git进行版本管理吧spa
==========================================.net
(二)版本控制
最近在作svn迁移到gitlab,因为以前一直是由svn作版本控制。最简单的方式是将svn的内容export出来,而后添加到gitlab便可。可是,若是svn用的时间很长了,并且不少commit,咱们但愿保存svn commit的信息以便作版本的控制和比较。幸亏git提供了相应的解决办法。code
- 已安装git
- 已安装gitlab
yum install -y git-svn
orm
svn帐号=git帐号名称<username@mail.com>
git svn clone svn://ip端口/projectname --no-metadata --authors-file=users.txt --trunk=trunk projectname cd projectname
git remote add origin git@xxx.xxx.xxx.xxx:root/projectname.git
git push -u origin master
参考文档:htm