svn repository migrated to git repository

Migration records, according to the actual operation, there are changes and improvements.

 

==========================================================================

(Note: chargeable)

SubGit version 2.0 starts to support remote subversion repositories, so creating Git mirrors eliminates the need for shell access to subversion repositories.
Project address:
http://subgit.com/index.html

 

==========================================================================

How to move the remote SVN repository to the local 
From: http://nowing.iteye.com/blog/844608
Often when the broadband network is not in good condition, it is an extremely painful thing to access the SVN repository on the Internet, not to mention Said to view the log information of the version library. At this point, if the entire remote repository can be synchronized to the local, and then all operations are performed on the local repository, the benefits are not to be mentioned. Fortunately, SVN has provided corresponding functions. The specific operation steps are as follows: 
1) Create a new repository locally: 
    svnadmin create D:\test 
2) Create the hook file pre-revprop-change.bat: (in the windows environment It is D:\test\hooks\pre-revprop-change.bat) 
    file with only one line of content to "exit 0". 
3) Initialize the synchronization operation: 
    svnsync init file:///D:/test <URL of the remote SVN repository> 
    (If a username/password is required, enter it as prompted. After success, the command line will output the information: Copy the properties of version 0) 
4) Execute the synchronization operation: 
    svnsync sync file:///D:/test 
   (if you need a username/password, enter it as prompted. If there is a lot of data in the remote SVN database, you need to wait slowly) 
5) If the remote SVN database has For a new update, simply repeat step 4. 


-------------- 

How to convert an SVN repository to a Git repository Follow 

the steps below to completely convert an SVN repository to a Git repository: 
1) Move the remote SVN repository to the local (this step is mainly to improve the speed of conversion and can also be ignored) 
   Here, it is assumed that the final SVN repository to be converted is file:///tmp/test-svn 

2) Use the git svn clone command Start the conversion 
    $ git svn clone file:///tmp/test-svn -T trunk -b branches -t tags 
    The git svn clone command will import the entire Subversion repository into a local Git repository. This is equivalent to running two commands git svn init plus gitsvn fetch against the provided URL. Because Git needs to extract each version, one at a time, and then commit them one by one. For a project with hundreds or thousands of commits, the time spent can be hours or even days (if your SVN repository is remotely networked, it's still a bit of a benefit to do the first step above. But Projects are usually submitted a lot of times, and a long wait is inevitable. Please wait slowly). 
-T trunk -b branches -t tags tells Git that this Subversion repository follows basic branch and tag naming conventions. If your trunk (equivalent to the master branch in Git, which represents the main line of development), branches or tags are named differently, you should change accordingly. Because of the commonality of this rule, you can use -s in place of the entire command, which means standard layout (s is the first letter of Standard layout), which is the content of the previous options. The following command has the same effect: 
  $ git svn clone file:///tmp/test-svn -s 
注意本例中通过 git svn 导入的远程引用,Subversion的标签是当作远程分支添加的,而不是真正的Git标签。导入的Subversion仓库仿佛是有一个带有不同分支的tags远程服务器。用“$ git show-ref”就可以看到转换后Git仓库的相关情况,结果类似如下: 
$ git show-ref 
1cbd4904d9982f386d87f88fce1c24ad7c0f0471 refs/heads/master 
aee1ecc26318164f355a883f5d99cff0c852d3c4 refs/remotes/my-calc-branch 
03d09b0e2aad427e34a6d50ff147128e76c0e0f5 refs/remotes/tags/2.0.2 
50d02cc0adc9da4319eeba0900430ba219b9c376 refs/remotes/tags/release-2.0.1 
4caaa711a50c77879a91b8b90380060f672745cb refs/remotes/tags/release-2.0.2 
1c4cb508144c513ff1214c3488abe66dcb92916f refs/remotes/tags/release-2.0.2rc1 
1cbd4904d9982f386d87f88fce1c24ad7c0f0471 refs/remotes/trunk 
而普通的 Git 仓库是类似如下模样: 
$ git show-ref 
83e38c7a0af325a9722f2fdc56b10188806d83a1 refs/heads/master 
3e15e38c198baac84223acfc6224bb8b99ff2281 refs/remotes/gitserver/master 
0a30dd3b0c795b80212ae723640d4e5d48cabdff refs/remotes/origin/master 
25812380387fdd55f916652be4881c6f11600d6f refs/remotes/origin/testing 
这里有两个远程服务器:一个名为gitserver,具有一个master分支;另一个叫origin,具有master和testing两个分支。 

3) 获取SVN服务器的最新更新到转换后的Git仓库(这步通常在连续的转换过程中就没必要了) 
    $ git svn rebase 

4) 转换SVN仓库的svn:ignore属性到Git仓库的.gitignore文件 
    $ git svn create-ignore 
    该命令自动建立对应的.gitignore文件,以便下次提交的时候可以包含它。如果在生成.gitignore文件前想先查看一下,运行命令“git svn show-ignore”即可。 

5) 转换SVN的标签为Git标签 
    $ cp -Rf .git/refs/remotes/tags/* .git/refs/tags/ 
    $ rm -Rf .git/refs/remotes/tags 
    This command turns the index of a remote branch that originally started with tag/ into a real (lightweight) tag. 
    I can't try this under Window, and the error "cp: cannot stat `.git/refs/remotes/tags/*': No such file or directory" is reported. You can use the following two standard commands to deal with it: 
$ git tag tagname tags /tagname ---- create a Git tag with the specified branch 
$ git branch -r -d tags/tagname ---- delete the specified remote branch 

6) Convert SVN branch to Git branch 
    $ cp -Rf .git/refs /remotes/* .git/refs/heads/ 
    $ rm -Rf .git/refs/remotes 
    This command turns the remaining indexes under refs/remotes into Git local branches 

7) Finally, push the converted local Git repository to the public Git server 
    $ git remote add origin [remote Git server address] 
    $ git push origin master --tags 
    All tags and trunks should now lie neatly in the new Git server. If you want to sync the branch to the remote Git server as well, change --tags to --all.

==========================================================================

 

+

+

+

=

+

+

+

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326322849&siteId=291194637