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