svn项目同步到gitLab

安装git

确保安装了git

新建一个文件夹svn-git

在文件夹中新建userinfo.txt文件,映射svn用户,这个文件主要是用于将SVN用户映射为Git用户(昵称及其邮箱)。

userinfo.txt具体格式如下:

复制代码
admin = admin <admin@163.com>
lisi= lisi<mominglong@163.com>
lmh = lmh <lmh@163.com>
ql = ql <ql@163.com>

Clone SVN项目至本地Git

进入svn-git文件夹,右键"git Bash"打开git命令窗口,然后执行命令:

复制代码
git svn clone "svn://47.92.83.81/test-repo"  --authors-file=userinfo.txt

#切换git账号:win+r 输入control打开"用户账户"-》"管理凭据",删除git凭据
git config --global user.name "root"
git config --global user.email"admin@example.com"

git remote add origin http://39.98.166.121:9980/root/test-repo.git
#创建main分支(PS:如果报"error: src refspec main does not match any",执行)
git checkout -b main
git pull --rebase origin main
git push -u origin main

参考文档

svn 代码迁移到git_svn代码迁移到git-CSDN博客

相关推荐
zoipuus2 天前
上传repo仓库到自己的gitlab
linux·gitlab·shell·全志·tina
刘马想放假2 天前
Git 从入门到进阶:一篇吃透版本管理的实战指南
git·gitlab
曹牧4 天前
Eclipse:SVN 回复
java·svn·eclipse
NexTunnel6 天前
公司老项目还在 SVN,远程维护怎么做更稳?
git·svn·gitlab·远程工作·nextunnel
鱼听禅7 天前
CentOS 源码模式配置SVNAdmin2管理SVN仓库
linux·svn·centos
想你依然心痛8 天前
持续集成在嵌入式开发中的实践:GitLab CI与交叉编译——自动化构建、固件生成
ci/cd·自动化·gitlab
Sean‘8 天前
GitLab 升级后 502:Puma 反复重启问题处理记录
docker·gateway·gitlab
_阿伟_9 天前
SVN简单使用教程
svn
NexTunnel9 天前
告别传统组网,也能安全访问公司 GitLab / SVN
安全·svn·gitlab
霸道流氓气质1 个月前
GitLab CI/CD 完全指南
linux·ci/cd·gitlab