SVN迁移到git服务器

1.创建文件夹,例如Demo
2.打开 git bash here,建议如此,cmd也行
3.创建users.txt
用户名=用户名<邮箱>
Nbad=Nbad<xxxx@qq.com>
4.复制Svn及其提交记录

主要是同步trunk里面的项目,tag不做处理的。

git svn clone svn://xxxxx --authors-file=users.txt --no-metadata --trunk=trunk --prefix "" -s my_project
复制指定的tag或branches
git svn clone -T branches/xxx svn://xxxx --authors-file=users.txt --no-metadata --prefix "" -s my_project

 

第二种方式

git svn init svn://xxxxxxxxxx
git svn fetch --authors-file=users.txt

5.查看之前的提交记录
git log
6.关联远程仓库
git remote add origin  https://xxxxx.git
7.提交到git
git push -u origin master

如果出现异常

error: failed to push some refs to 'https:xxxxxx.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

执行下面的提交方式

git push -u origin master -f