1. 程式人生 > >svn遷git保留commit記錄

svn遷git保留commit記錄

itl files xxx found 導致 error failed pro 保留

svn to git

一.使用svn2git工具

1.yum install -y ruby git git-svn(配置epel源)
2.gen install svn2git
3.svn2git http://10.6.60.40/svn/XXXX/SourceCode --notrunk --authors /root/users.txt --branches=06platform --branches=06platform/inttest --notag
#如果在分支下還有子目錄需要作為分支,使用--branches參數指定path(--branches=06platform/inttest)
4.處理多余分支(git branch -d/-D branch)

5.處理目錄(處理目錄後需要 git commit、git add、git commit)
6.git remote add origin [email protected]:CoreProjectNew/business/frontend.git
7.git push origin --all


二.使用 git svn clone

遷移準備:映射用戶文件
1.git svn clone http://10.6.60.40/svn/XXXXSourceCode --authors-file=/root/author.txt --branches=26prpins prpins
2.git checkout -b inttest inttest(處理遠程分支為本地分支)

3.git branch -d/-D branch(處理多余分支)
4.處理目錄(處理目錄後需要 git commit、git add、git commit)
5.git remote add origin [email protected]:CoreProjectNew/business/frontend.git
6.git push origin --all

參數說明:

http://10.6.60.40/svn/XXXX/SourceCode #svn倉庫地址
--authors-file #映射用戶文件
--branches #分支

prpins #項目dir name


遷移過程中因為項目過大或svn服務器不穩定等導致中斷,可以使用git svn fetch 更新遠程分支

1.cd project/
2.git svn fetch

錯誤記錄:

svn2git工具可能會發生未知錯誤

1.W: Ignoring error from SVN, path probably does not exist: (160013): Filesystem has no item: File not found: revision 100, path ‘/SourceCode/25zyicloan‘

解決:這個可能是找不到歷史版本導致的,最好指定--revision參數

2.RA layer request failed: REPORT of ‘/svn/XXXX/!svn/me‘: Could not read chunk size: connection was closed by server (http://10.6.60.40) at /usr

解決:遇到這種讀取塊失敗被迫關閉連接,使用git svn clone ,可能是網絡等原因導致

3.Author: xx not defined in users.txt file

解決:這個就是保留commit記錄用戶映射不全,加入users.txt就好了,在做映射時從svn庫獲取全部用戶就行

幫助:

https://help.github.com/articles/source-code-migration-tools/ (github help) 這裏詳細說明了標準庫和非標準庫遷移

svn遷git保留commit記錄