SVN 项目迁移到GIT

为了统一、规范开发流程,以及CICD的推进,将SVN整体迁移至git环境,需要将历史记录同步到git

本文参考了以下链接
https://blog.csdn.net/ouyang_peng/article/details/80372805
https://www.cnblogs.com/goodwell21/p/10044818.html

主要分三步

1.svn用户映射
到svn工程目录下执行命令
svn log --xml | grep "^' '{print 1}' > userinfo.txt

获取当前项目的用户,然后每一天修改为以下格式
malone=malone< [email protected]>

SVN 项目迁移到GIT_第1张图片
userinfo.txt.png

新建个文件夹,把userinfo.txt拷贝过来(项目过多的话此过程不需要重复完成,执行一遍后,将所有用户名称都写到此txt中可重复利用

2.git svn clone
在上userinfo.txt目录执行命令
git svn clone http://[email protected]:8011/svn/sdk_dev/iOS/AutoTest-iOS GitProject --authors-file=userinfo.txt --no-metadata(svn copy URL获取地址)
等待执行完成后,进入GitProject目录,执行git log 确定git成功

3.push到git
先在git/gitlab新建项目
git remote add origin [email protected]:sdk/autotest-ios.git
git remote -v(执行确定添加成功)
git push origin --all (执行成功后到git/gitlab页面刷新看看是否成功,查看历史页面是否同步成功)

错误:
1.执行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
解决办法: 先执行git remote add origin [email protected]:sdk/autotest-ios.git命令

2.Author: ** not defined in users.txt file
1)是由于userinfo.txt文件格式有误,应该为 malone= malone < [email protected]>
2)是userinfo.txt真的少了该用户的配置(修改后记得删除git的目录 再执行命令)

你可能感兴趣的:(SVN 项目迁移到GIT)