Strategically the business wanted to adopt a number of new tools including Slack (team messaging, collaboration), Asana (Project and Task management) and Git, so I was tasked with migrating our project from SVN to Git. The repository would be hosted on github and thereby minimise maintenance as there was no server to manage to ensure there was sufficient disk space, or upgrading the scm tool to a later version.
This post describes the process.
The atlassian tutorial  provides 5 simple steps to help migrate users from SVN to Git.
- Preparing the environment
- Converting the SVN repository to a local Git repository
- Synchronizing the local Git repository when the SVN repository changes
- Sharing the Git repository with developers.
- Migrating development effort from SVN to Git.
1. Preparing the EnvironmentAfter downloading and executing the migration script, it was found that the versions of Git and SVN that were available with the Linux distribution  were not of the required versions. It was therefore necessary to install the latest version of Git (2.5.2) from source .
Once again, after downloading the Git source, it was found that the necessary dependencies such as the gcc compiler and make tool were missing. These were installed using the yum Development Tools package.
The atlassian migration-script was still complaining about the SVN version so the latest version (1.8.14) was also installed by configuring an additional yum repository .
The final piece of the jigsaw was to install the correct subversion perl bindings for the updated SVN by executing yum install subversion-perl
Finally, the svn-migration-scripts verify command was able to successfully execute.
2. Converting the SVN repository to a local Git repositoryThe tutorial mentions running git svn clone --stdlayout --authors-file=authors.txt
This fails with the following error if the SVN repository requires authentication.
Therefore it is necessary to first run the svn checkout command so that svn caches the credentials and then also install the Perl Term ReadKey package:
After the shell initiation, install the ReadKey package:
It should now be possible to create a local Git repository from the SVN repository.
The cloning of the SVN repository creates the SVN branches and tags as remote branches. The clean-git script included in the svn-migration-scripts.jar kept on deleting the branches and tags that were being created so git branch only showed the master branch.
Executing "java -Dfile.encoding=utf-8 -jar ../svn-migration-scripts.jar clean-git --force --no-delete" allowed us to create the local git branches including all the obsolete and deleted ones.
Executing git branch now showed the local git branches, but git tag was still not returning any tags.
The following script was used to create the git tags changes the path to the tags.
|Create Git Tags|
3. Synchronizing the local Git repository when SVN changes
The synchronizing of the local Git repository with SVN changes works as described in the documentation by simply fetching the latest changes, rebasing the Git repository and then doing a clean up.
4. Sharing the Git repository
This step involves pushing the local Git repository to a public Git repository server and then allowing developers to pull and push commits to and from the public repository.
To facilitate pushing changes to a remote repository, Git uses a 'remote' reference as an alias for the remote repository URL. The remote reference can be anything one chooses but if the remote repository is going to serve as the official codebase for the project, it is conventionally referred to as 'origin',
Once the remote has been set up, the changes can be pushed to the remote repository.
Instead of bitbucket, our project team used github to host our remote repository. The uploading of the git repository failed as there were some files with a history of being larger than 100MB in size which github doesn't allow. The file contained the binary data of images that were pruned once development matured (as the images were moved to be managed in the production environment and not within the codebase). However, to allow the uploading of the Git repository, it would be necessary to remove the history of the offending file. This is where the BFG utility came to the rescue .
To Be Continued....
 Red Hat Enterprise Linux Server release 6.6 (Santiago)