SVN单个项目迁移到Gitlab,保留历史提交记录

1.版本说明

svn --version:版本1.14.1

git --version:版本2.43.0.windows.1

git svn --version:执行不报错,显示版本git-svn version 2.43.0.windows.1 (svn 1.14.2)

2.提取用户的列表

提取所有SVN用户的列表到当前路径下的userInfo.txt文件

git 复制代码
# 可以修改指定的邮箱后缀email.com
svn log http://svn的仓库地址/分支名 -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2"="$2" <"$2"@email.com>"}' | sort -u > ./userInfo.txt

3.使用 git-svn 克隆 SVN 存储库

在userInfo.txt文件所在的路径下执行命令

git 复制代码
git svn clone http://svn的仓库地址/分支名 --no-metadata --no-minimize-url --authors-file=userInfo.txt demo

--no-metadata:不拉取SVN metadata附加信息

--no-minimize-url:克隆时只会拉取你要求的分支项目,不会自动拉取上级内容。不添加此参数会导致不拉取【http://svn的仓库地址/分支名】而拉取【http://svn的仓库地址】

--authors-file=userInfo.txt:根据提供的userinfo.txt文件,将提交的作者名称映射到对应的用户邮箱地址。

demo:本地存放svn指定路径的内容的文件夹

4.push到GitLab仓库

现状

git 复制代码
# 本地master分支和远程git-svn分支
$ git branch -a                                                                       
* master
  remotes/git-svn

# 没有任何输出,没有关联的远程git仓库
git remote -v

添加远程仓库并push

git 复制代码
git remote add origin https://你的gitlab_project_path
git remote -v
git push -u origin master

5.参考

从 Subversion (SVN) 迁移到 Git - Azure Repos | Microsoft Learn

SVN单个项目迁移到Gitlab_svn代码迁移到gitlab-CSDN博客

相关推荐
飞哥专栏2 天前
阿里云效 = Jenkins + Gitlab + 免费服务器
阿里云·gitlab·jenkins
西部森林牧歌3 天前
Arbess零基础学习 - 使用Arbess+GitLab实现.Net 项目构建/主机部署
ci/cd·gitlab·arbess·tiklab devops
西部森林牧歌3 天前
Arbess零基础学习 - 使用Arbess+GitLab实现Python项目构建/主机部署
python·ci/cd·gitlab·tiklab devops
灰勒塔德3 天前
ubuntu 部署 gitlab docker服务
docker·容器·gitlab
西部森林牧歌3 天前
Arbess零基础学习 - 使用Arbess+GitLab实现PHP项目构建/主机部署
ci/cd·gitlab·php·tiklab devops
逐风&者3 天前
windows SVN 修改提交作者、提交注释、提交日期
svn
rain bye bye3 天前
svn: E155000:
svn
浪潮IT馆3 天前
Alibaba Cloud Linux 3 安装 SVN
linux·运维·svn
爱宇阳5 天前
GitLab CI/CD 集成 Harbor 全面教程
ci/cd·gitlab·harbor
雪碧聊技术5 天前
gitLab如何新建分支(根据某个分支)
gitlab·new branch·新建分支