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

相关推荐
aXin_ya2 天前
SVN使用
svn
极小狐2 天前
从 GitLab Flow 到 Pipeline:分支策略 + CI/CD + 运维一文打通
ci/cd·gitlab·devops·极狐gitlab
猫头虎3 天前
GitHub 入门教程:如何加入并为开源项目贡献代码
gitee·开源·gitlab·github·开放原子·开源协议·gitcode
悠然南风5 天前
【云原生学习】Prometheus监控、GitLab与Jenkins部署实战
kubernetes·gitlab
极小狐6 天前
极狐GitLab Runner 自托管安全加固指南
安全·ci/cd·gitlab·devops·runner·安全加固
钝挫力PROGRAMER7 天前
Windows Docker 环境搭建 GitLab CI/CD 流水线
windows·docker·gitlab·gitlab-runner
EXI-小洲8 天前
Pycharm 使用SVN进行拉取或提交 - SVN基本使用
svn·pycharm·版本控制
EXI-小洲9 天前
MacOS IDEA将本地项目代码上传至SVN空仓库
macos·svn·intellij-idea
我一定会有钱13 天前
打造完美工作流:Git 配置”一次推送,三端同步”(Gitee/GitCode/GitHub)
开发语言·windows·vscode·搜索引擎·gitlab·github·visual studio code