SVN迁移至GitLab及故障处理记录

项目实例 / 2020-07-03

知识共享许可协议
本作品采用知识共享署名-非商业性使用 4.0 国际许可协议进行许可。

一:迁移操作

1、首先在GitLab服务器安装git-svn这个专用软件来迁移
yum install -y git-svn
2、找个目录,在里面进行迁移操作(此处不涉及账号迁移,需要账号迁移请自行百度或谷歌)。
mkdir svn_backup
cd svn_backup
git svn clone svn://192.168.0.172
3、接下来系统自动进行打包与压缩,时间视项目大小而定;以下仅为示意。
r86 = 682d4ee82b5f62b61627ffe0d4fb86267e7fa131 (refs/remotes/git-svn)
Auto packing the repository for optimum performance. You may also
run "git gc" manually. See "git help gc" for more information.
Counting objects: 138900, done.

Delta compression using up to 4 threads. #自动识别CPU核心数并使用全部核心进行压缩
Compressing objects:  98% (136540/137972) 
4、使用SSH方式push导出来的SVN仓库,如果使用HTTP方式传输会有大小限制,过大会报错The remote end hung up unexpectedly
git remote add origin git@192.168.0.105:root/yx-Design.git
5、push到新建的空仓库
git push -u origin --all

二:故障处理

remote: 
remote: ========================================================================
remote: 
remote: The project you were looking for could not be found.
remote: 
remote: ========================================================================
remote: 
fatal: Could not read from remote repository.
出现上面这种情况,很多时候都是因为没有设置SSH密钥的原因,如下所示

image-20200703142642270.png

添加完后再执行push操作就可以继续下去了,如下所示:
[root@gitlab 192.168.0.172]# git push -u origin --all
Counting objects: 152334, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (146617/146617), done.
Writing objects: 100% (152334/152334), 71.23 GiB | 39.73 MiB/s, done.
Total 152334 (delta 7637), reused 135263 (delta 3910)
remote: Resolving deltas: 100% (7637/7637), done.
remote: Checking connectivity: 152334, done.
To git@192.168.0.105:root/yx-Design.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.

这时候上去GitLab界面就可以看到新提交的内容了

世间微尘里 独爱茶酒中