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博客

相关推荐
鳄鱼杆20 小时前
服务器 | 2026年Ubuntu 24.04下GitLab Docker 企业级部署
服务器·ubuntu·gitlab
金融小师妹20 小时前
AI供需模型解析:OPEC产量断崖式下滑与全球能源定价重构机制
大数据·深度学习·svn·逻辑回归·能源
FreeBuf_2 天前
黑客滥用 GitHub 和 GitLab 托管恶意软件并实施凭证钓鱼攻击
gitlab·github
有理想的打工人5 天前
gitlab的参数设置与团队管理
gitlab
有理想的打工人5 天前
gitlab群组管理与ssh链接
ssh·gitlab
M-Ellen5 天前
从零搭建 Windows + WSL2 + Docker + GitLab CI/CD 完整手册
ci/cd·docker·gitlab
大脸胖柴5 天前
webStorm+gitLab操作学习
学习·gitlab·webstorm
曹牧5 天前
svn:“relocate”操作中出现“no uuid but wc has”的错误
svn
曹牧5 天前
svn: svn relocate ‌之externals‌
数据结构·svn
jekc8687 天前
Ubuntu-GitLab
服务器·ubuntu·gitlab