Converting a Subversion Repository to a Git Repository

Recently I was tasked with converting some Subversion repositories to Git repositories. (In particular GitHub) I was to keep all the original check-in details and map those details to our user’s new GitHub user accounts.

There are a few things to keep in mine when converting from one repository to another. The most important aspect of the conversion is that you will need to tell the Git repository who it was that performed the check-ins on the subversion repository.

To complete the conversion process, follow these steps:

  1. Create a new file called authors.txt. (I will explain the contents of this file below)
  2. Create a new folder for the Git repo to reside in.
  3. Open a Git Shell command window and execute the following command. This will effectively download the SVN version of your repository and convert it to a GIT repository using the authors.txt file to map user information between the two respositories.o   git svn clone https://yoursvnrepository.com/repository –no-metadata –A C:/DirectoryToAuthors/authors.txt C:/DirectoryToNewGitRepo/GitRepo
  4. Commit and sync your Git repository. In my case, I used the GitHub for Windows application. This allowed me to drag my new Git repository folder to the windows application and sync it.

 

Contents of the authors.txt file

The authors.txt file is the map between your SVN user account information and your Git user account information.

You will want to create a file that has the following format: (Note: The GitEmailAddress for GitHub is your publicly accessible email address, not the address you sign in with)

SvnUsername = GitUsername <GitEmailAddress>

Ex: nathan = Nathan Renico <nathan@renicorp.com> or SERVER\nathan = Nathan Renico <nathan@renicorp.com>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: