SubGit 2.0 EAP is Open!
Need to build a writable Git mirror of a remote Subversion repository?
This guide assumes you've downloaded and unpacked SubGit archive and now may run <subgit_home>/bin/subgit[.bat] script by typing subgit in the command line.
You need to have Java 1.5 or newer installed.
Examples in this guide assume Linux or OS X, but this guide should work on Windows nevertheless.
1. Prepare your Subversion repository
$ subgit configure repos SubGit version 1.0.0-EAP ('Miai') This is an EAP build, which you may not like to use in production environment. Subversion to Git mapping has been configured in 'repos': <root> : repos/.git CONFIGURATION SUCCESSFUL Adjust 'repos/conf/subgit.conf' file and then run subgit install "repos" to complete SubGit installation.
SubGit have just generated configuration files that you may now adjust if necessary.
2. [optional] Adjust configuration at repos/conf/subgit.conf.
Default single-project configuration:
[core] shared = false logs = .subgit/logs errorReport = .subgit/error authorsFile = conf/authors.txt [git "default"] translationRoot = / repository = .git trunk = trunk branches = branches/* shelves = shelves/* tags = tags/* [daemon] pidFile = subgit.pid idleTimeout = 5 classpath = .subgit/lib
Change linked Git repository location:
... [git "default"] translationRoot = / repository = /var/git/project.git trunk = trunk branches = branches/* shelves = shelves/* tags = tags/* ...
Change default layout (only do that if yours is different from the default trunk/branches/tags one):
... [git "default"] ... trunk = main branches = branches/* shelves = shelves/* tags = tags/* ...
SubGit detects multiple projects in Subversion repository and generates appropriate number of [git] sections, one for each project.
3. [optional] Add user names mapping to repos/conf/authors.txt.
svnUserName = gitUserName <email> semen.vadishev = Semen Vadishev <email@example.com> ...
4. Complete SubGit installation
$ subgit install repos SubGit version 1.0.0-EAP ('Miai') This is an EAP build, which you may not like to use in production environment. Subversion to Git mapping has been found in 'repos': <root> : repos/.git Translating Subversion revisions to Git commits... Subversion revisions translated: 25. Total time: 7 seconds. INSTALLATION SUCCESSFUL You may now run git clone "repos" "repos-git" to obtain Git clone of Subversion repository.
Congratulations, SubGit is installed now! Try the following:
# # push a change with Git # $ git clone repos repos-git $ cd repos-git # make changes to some of the files $ git add file.txt $ git commit -m "Svn Rules! I want Subversion!" $ git push ... # # commit a revision with Subversion # $ svn co file:///.../repos/trunk wc $ cd wc # make changes to some of the files $ svn commit -m "Git Rules! I want Git!" ...
Now use 'svn log' or 'git log' commands to make sure that both changes are available both for the Git and Subversion users.
Read Apache HOWTO for information on how to configure Apache web server to serve both Subversion and Git repositories.