Migrate from SVN to Github Source control

Before migration make sure you have installed Github client, Java development kit. You can download JDK from https://docs.oracle.com/cd/E19182-01/820-7851/inst_cli_jdk_javahome_t/ . Make sure your JAVA_HOME is also set under environment variables

Please follow the step by step guide mentioned below:

  1. Create a new folder and navigate to the folder. eg: C:\svnproject
  2. Now we need to extract the SVN project and history, thereafter clone the project for GitHub
    • Open the command prompt and navigate to C:\svnproject
    • Extract project and history from SVN and clone for GitHub by using the following syntax
      git svn clone <SVN Path>
      eg: git svn clone svn://svndomain/ApplicationPath
    • Once you execute the above command, it will prompt you to enter SVN username and password, if SVN is not already configured in your system.
    • After entering your SVN credentials, it will extract the history from SVN and make a clone for GitHub. This step may take time depending upon the history size.

     

  3. Add the cloned project to the remote GitHub
    • In the current directory, execute the following command to create a remote link with GitHub
      C:\svnproject>git remote add origin https://github.com/repo-name
  4. Verify the GitHub remote configuration
    • In the current directory, execute the following command to verify the remote link configuration is correct
      C:\svnproject>git remote -v
    • If the configuration is correct, we will get the following output with the remote GitHub link
      origin https://github.com/repo-name (fetch)
      origin https://github.com/repo-name (push)
  5. Push the source to the GitHub repo
    • In the current directory, execute the following command to push the source to GitHub repo, this may take time, based upon the size of the project
      C:\svnproject>git push -u origin master
  6. That’s it, you successfully moved the SVN project with history to GitHub

Leave a Reply

Your email address will not be published. Required fields are marked *