svn項目遷移到git

歷史原因,我司部分前端項目在svn托管。在重構和遷移并行的情況下,開啟了svn項目遷移git的操作。
目前已遷移完成,最好的遷移方式是找OP幫忙要一臺同網(wǎng)段的機器,比如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 參數(shù)解釋

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. 再執(zhí)行 【問題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文件夾,
執(zhí)行 git prune
再執(zhí)行 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 結束后,發(fā)現(xiàn)目錄里面是空,
但是.git文件夾又包含log賊大,是因為沒有獲取文件
所以要重新獲取下文件才行

問題5-解決方案

git svn clone -r HEAD <url>/root/projectA 

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容