SVN倉庫遷移到Git遇到的兩個問題和解決辦法


OS: CentOS 7.0

准備: git svn git-svn

sudo yum install git
sudo yum install subversion
sudo yum install git-svn

版本:

subversion x86_64 1.7.14-10.el7
git-svn x86_64 1.8.3.1-6.el7_2.1

問題一

perl: subversion/libsvn_subr/dirent_uri.c:321: canonicalize: Assertion `*src != '/'' failed.
error: git-svn died of signal 6

原因是我使用的本地倉庫,在寫url的時候格式不對,正確的寫法如下:

git svn clone file:///home/***/Desktop/SVN/test_repo/

本地倉庫需要加上file://前綴

問題二

Initialized empty Git repository in /home/****/.git/
Couldn't open a repository: Unable to connect to a repository at URL 'file:///home/***': Unable to open an ra_local session to URL: Unable to open repository 'file:///home/***': Expected FS format between '1' and '4'; found format '6' at /usr/share/perl5/vendor_perl/Git/SVN.pm line 310.

這個錯誤是由於建立版本庫的時候使用的svn版本較高,建立了FS格式為6的版本庫,在低版本的svn客戶端下不能識別。
解決辦法為:
進入待遷移的版本庫中,進入db文件夾,修改format文件

vim format

  1 6
  2 layout sharded 1000                           

將6改為4就可以了。

P.S. 將得到的本地Git repo 上傳到remote repo

將本地repo中的branch存為Git的tag。

#查看branches
git branch -r

#將branch轉為tag
git tag tag_name existed_branch_name

#將tags推送到remote repo
git push origin master --tags

#查看repo中tags的命令為
git tag
#或
git tag -l

#獲取指定的tag
git checkout tag_name

#轉換到指定的tag上工作,並為該tag新建branch
git checkout -b branch_name tag_name

轉載請聯系chasenwu@live.com


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM