历史原因,我司部分前端项目在svn托管。在重构和迁移并行的情况下,开启了svn项目迁移git的操作。
目前已迁移完成,最好的迁移方式是找OP帮忙要一台同网段的机器,比如svn是 svn://191.168.1.1 ,这台机器的地址就应该是192.168.1.2。ssh登录上去,然后那速度杠杠的参考我们4w的svn version大概1小时就搞定了,如果机器还有云服务机器,那岂不是爽歪歪啦,这进行git svn clone才是最佳的迁移方式。
本来以为 按照 https://git-scm.com/book/en/v2/Git-and-Other-Systems-Migrating-to-Git 一步一步来即可,
没想到遇到的问题还真不少,不知道是sierra问题还是怎么了
git svn clone 参数解释
r指定起止版本号。
no-metadata阻止git导出SVN包含的一些无用信息。
authors-file必须指定svn帐号在git中的映射。
trunk指定导出仓库的主干项目路径。
branches指定svn的分支项目路径。
问题1
Can't locate SVN/Core.pm in @INC (you may need to install the SVN::Core module)
问题1-解决方案
xcode-select --install // 我本机是有xcode的。。
$ sudo ln -s /Applications/Xcode.app/Contents/Developer/Library/Perl/5.18/darwin-thread-multi-2level/SVN /System/Library/Perl/Extras/5.18/SVN
$ sudo ln -s /Applications/Xcode.app/Contents/Developer/Library/Perl/5.18/darwin-thread-multi-2level/auto/SVN/ /System/Library/Perl/Extras/5.18/auto/SVN
问题2
/System/Library/Perl/Extras/5.18/SVN: Operation not permitted
问题2-解决方案
1. 重启按 Command+R,进入恢复模式,打开Terminal。
2. 键入命令 csrutil disable
3. 重启
4. 再执行 【问题1】命令
问题3
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
error: The last gc run reported the following. Please correct the root cause
and remove .git/gc.log.
Automatic cleanup will not be performed until the file is removed.
warning: There are too many unreachable loose objects; run 'git prune' to remove them.
gc --auto: command returned error: 255
问题3-解决方案
cd 进入到你的git文件夹,
执行 git prune
再执行 git svn fetch
问题4
error: invalid object 101231 1f123...88basd for 'XXXX'
fatal: git-write-tree: error building trees
write-tree: command returned error: 128
问题4-解决方案
git svn gc
问题5
git clone 结束后,发现目录里面是空,
但是.git文件夹又包含log贼大,是因为没有获取文件
所以要重新获取下文件才行
问题5-解决方案
git svn clone -r HEAD <url>/root/projectA