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

相关推荐
极小狐12 小时前
定义可引用的 CI/CD 配置文件中的输入参数
gitlab·devsecops·devops·极狐gitlab·安全合规
佚明zj12 小时前
如何配置ssh key 到gitlab, 实现git push
git·ssh·gitlab
极小狐12 小时前
极狐GitLab CI/CD 功能合集(超详细教程)
ci/cd·gitlab·devsecops·devops
黑风风18 小时前
解决 GitLab CI/CD 中的 `413 Request Entity Too Large` 错误
ci/cd·gitlab
wang_book1 天前
Gitlab学习(007 gitlab项目操作)
java·运维·git·学习·spring·gitlab
黑风风2 天前
如何安装和注册 GitLab Runner
gitlab
baowxz2 天前
svn回退到以前历史版本修改并上传
svn·回退到历史版本·修改并上传·回退到以前版本
极小狐2 天前
Ruby-SAML CVE-2024-45409 漏洞解决方案
gitlab·devsecops·devops·极狐gitlab·安全合规
向往风的男子3 天前
【devops】devops-gitlab之部署与日常使用
运维·gitlab·devops
soaring01213 天前
Gitlab实现多项目触发式自动CICD
pipeline·gitlab·triggers·access tokens