Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This is a quick step-by-step guide to importing and mirroring a remote Subversion project with the standard layout (the trunk, branches, and tags) into a Git repository using SubGit.

Table of Contents


Note
titleBefore you

...

start

Make sure that you have SubGit binary files downloaded and Java (JRE) installed on your system.

  1. Create a 

     

    bare 

      Git repository and set up the

    Git repository

    Set up import and mirror configuration settings by running the following command:

    $ subgit configure --layout auto --trunk TRUNK_PATH SVN_PROJECT_URL GIT_REPO_PATH

    where:

    TRUNK_PATH  is a relative path to the trunk folder. Specify      Specify the path relative to a Subversion project URL.

    SVN_PROJECT_URL is an 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, into which where your Subversion project will be imported or mirrored.


    Note

    On Windows, all commands should start with subgit.bat  (e.g.  subgit.bat configure etc.)


    Info

    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.

    Optionally, review


  2. Review and adjust the

    following
    the branch

    configuration settings

    to import or mirror your Subversion project in a proper way:



    • Branch mapping rules are specified in the  [svn]  section of the SubGit configuration file that is 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:

      <Subversion-Path-Pattern>:<Git-Reference-Pattern>

      The paths to the Subversion directories are defined relative to a Subversion project URL. The  
      The mapping rules for a Subversion project with the standard layout are the following:

      trunk = trunk:refs/heads/master
      branches = branches/*:refs/heads/*
      tags = tags/*:refs/tags/*
      shelves = shelves/*:refs/shelves/*

      For more information on the branch, tag, and shelves mapping see the Branches and tags mapping  mapping   section.


    • the author Author mapping rules are specified in the    authors.txttxt  file,  file     that is located at    GIT_REPO_PATH/subgit/authors.txt

      Use the following format to map Subversion users (svnUser) to Git authors (Author Name <email>):

      svnUser = Git User <user @example .com>

      For more information on the author mapping, see the Authors' mapping    mapping section  section.

    To import


  3. Import a Subversion project

    , run

    Run:

    $ subgit  import   GIT_REPO_PATH

    After import, the synchronization between the Git and the Subversion repositories is disabled.To mirror   


  4. Mirror a Subversion project

    , run

    Run:

    $ subgit install GIT_REPO_PATH

    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.


  5. Clone the bare Git repository

    to

    To create the directory with the project working tree, run:

    $ git clone GIT_REPO_PATH WORK_DIR_PATН

    where:

    WORK_DIR_PATH  is a path is a     path to a working directory, in which you want to create the project working tree.

    Note

    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 more likely that    the automatic branch and tag mapping hasn’t worked correctly. In this case, specify the mapping rules manually in the [svn] section of the SubGit config file and run the and    run    subgit install GIT_REPO_PATH command againPATH  again.

    For more information on the branchbranches, tagtags, and shelves mapping see the Branches and tags mapping section.


  6. Register your

    Git Repository with a registration key. To do that, upload

    SubGit instance

    Upload the file with the registration key to your Git server and run:

    $ subgit register --key subgit.key GIT_REPO_PATH


    Info

    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.