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:
- Create a new file called authors.txt. (I will explain the contents of this file below)
- Create a new folder for the Git repo to reside in.
- 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
- 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 <firstname.lastname@example.org> or SERVER\nathan = Nathan Renico <email@example.com>