1. 将svn中的所有用户信息与git账号进行映射。svn用户信息需映射为git中存在的账号,形成文档如下:userinfo.txt
zhangsan1 = lisi1 <邮箱>
zhangsan2 = lisi1 <邮箱>
zhangsan3 = lisi1 <邮箱>
2. 拉取svn代码
- 在电脑中 创建文件夹 用户文件存放下面。当然需要把userinfo.txt文件放置于其同层目录中 比如work文件夹中:存放newprojects文件夹及userinfo.txt文件
- git svn命令克隆的svn中的需要迁移git的代码。在work文件夹中执行:
git svn clone svn://xx.x.x.xxx/xx/xx --no-metadata --authors-file=userinfo.txt newprojects --username=xxx
- 执行后 可能需要输入密码xxxxx。 执行完毕即拉取svn代码完毕
3. 在git中创建新项目
在git中创建新项目(http://xx.x.x.xxx:xxx/xx/xx.git),不能初始化readme文件,用于迁移svn代码
4. 关联git仓库保留svn历史记录
cd newprojects
在specialTopic文件夹下执行命令关联git仓库:
git remote add origin http://xx.x.x.xxx:xxx/xx/xx.git
git push -u origin --all
git push -u origin --tags
5. mac报错处理
执行git svn命令报错
git: ‘svn’ is not a git command. See ‘git --help’.
解决:
brew install git subversion (这个不对)
brew install git-svn
下载git-svn过程中下载python3.11报错:(https://zhuanlan.zhihu.com/p/115450863)
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
- 通过python官网下载python3.11 并更改变量后 下载依旧报错
- 通过配置host: 199.232.28.133 raw.githubusercontent.com,再次下载git-svn报错:从 error 7 变成了 error 35
- 通过修改brew镜像方式解决:(https://zhuanlan.zhihu.com/p/547898033)
更换后 再次执行brew install git-svn 下载过程python3依旧报错
最后多次继续执行下载命令尝试 最终下载成功。