This is a quick step-by-step guide to importing and mirroring a remote Subversion project with the standard layout (trunk, branches, and tags) into a Git repository using SubGit.
Make sure that you have SubGit binary files downloaded and Java (JRE) installed on your system. |
Set up import and mirror configuration settings by running the following command:
|
TRUNK_PATH
is a relative path to the trunk folder. Specify the path relative to a Subversion project URL.
SVN_PROJECT_URL
is a URL to a Subversion project that you want to import or mirror.
GIT_REPO_PATH
is a path to the directory for creating a bare Git repository ( a repository without a working tree ). Note that bare Git repository names end with
.git
.
SubGit identifies the layout of a Subversion project (the trunk, branches, tags, and shelves) and creates a bare Git repository, where your Subversion project will be imported or mirrored.
On Windows, all commands should start with |
You will be asked to log in to a Subversion repository unless the Subversion credentials cache is already stored in the default Subversion configuration directory. For more information on the Subversion credentials cache and the default Subversion configuration directory, see the Using the Subversion credentials cache section. |
Branch mapping rules are specified in the
[svn]
section of the SubGit configuration file, located at
GIT_REPO_PATH/subgit/config
Use the following format to map Subversion directories (such as the trunk, branches, tags, and shelves) to Git references:
|
The paths to the Subversion directories are defined relative to a Subversion project URL.
The mapping rules for a Subversion project with the standard layout are the following:
|
For more information on the branch, tag, and shelves mapping see the Branches and tags mapping section.
Author mapping rules are specified in the
authors.txt
file, located at
GIT_REPO_PATH/subgit/authors.txt
Use the following format to map Subversion users (svnUser
) to Git authors (Author Name <email>
):
|
For more information on the author mapping, see the Authors' mapping section.
Run:
|
After import, the synchronization between the Git and the Subversion repositories is disabled.
Run:
|
This command installs SubGit binary files on the Git repository and enables the mirror.
The Git repository stays synchronized with the original Subversion repository. The changes committed either to Subversion or Git repositories are synchronized in both directions.
To create the directory with the project working tree, run:
|
WORK_DIR_PATH
is a path to a working directory, in which you want to create the project working tree.
If Git warns you that you clone an empty repository, and after the command execution you don't see your project files in the working directory, most likely it means that the automatic branch and tag mapping hasn’t worked correctly. In this case, specify the mapping rules manually in the For more information on branches, tags, and shelves mapping see the Branches and tags mapping section. |
Upload the file with the registration key to your Git server and run:
|
You can use SubGit for an unlimited number of users without any registration key for 7 days. You can use SubGit for an unlimited number of users for a trial period of 30 days. Apply for a registration key here . For more information on SubGit licensing and registering Git repositories see the Licensing section. |