Migrating from SVN to Git (Acquia Cloud Professional only)

Acquia Cloud supports the Git and SVN version control systems, though Git is preferred. You can migrate from Subversion (SVN) to Git at any point. Acquia recommends changing your code repository's version control system only one time, if ever, because you will lose the revision history of your codebase when switching version control systems.

Who can migrate a repository to Git

Acquia Cloud Professional customers can switch from SVN to Git on their own, while Acquia Cloud Enterprise customers must contact Acquia Support to complete the migration. In order to switch an Acquia Cloud Professional code repository to Git, you must be an Owner or Administrator for the application.

Acquia Cloud Free customers must use Git and cannot use SVN.

Before you begin

Before you begin migrating, make sure that all the latest code has been committed to trunk in SVN. Also make sure that your SVN client uses TLS v1.1 or greater. Acquia Cloud requires TLS v1.1 or greater for SSL to connect with an Acquia Cloud code repository. Although SVN version 1.8 or greater may include TLS v1.1 (allowing connectivity to your repository), earlier versions generally used TLS v1.0, which is not supported by Acquia Cloud. For more information, see Using Subversion: Requirements.

Procedure

The process for migrating from SVN to Git on Acquia Cloud Professional has three main steps:

  1. Enabling Git for your Acquia Cloud Professional application, using the Acquia Cloud interface.
  2. Setting up a local repository
  3. Deploying from your new Git repository

Tools, such as the svn2git tool, can help with the migration process, but Acquia does not provide support for these tools.

Enabling Git for your Acquia Cloud Professional application

  1. Sign in to the Acquia Cloud interface and select your application.
  2. Ensure that the Production environment is set to Pre-Launch mode. For information about how to switch the environment to Pre-Launch mode, see Using Production mode to protect your live application.
  3. Click Application Info and copy the SVN URL to a text file or other location where you can retrieve it again.
  4. Click Switch VCS.

    Click Switch VSC

  5. In the Switch version control system dialog, click Switch to Git.
  6. Change the environment back to Production mode. For information about how to switch the environment to Production mode, see Using Production mode to protect your live application. Note that the Code entity in your environments shows No code deployed. This means that the Git repository is currently empty, and the site will be running from the old SVN repository. Your Drupal application is still running from its codebase, so you can continue to add and modify content; however, you should enforce a code freeze until your Git repository is fully set up, as described in Deploying from your new Git repository.

Setting up a local repository

After you have enabled Git for your application, you need to set up a local Git repository.

  1. Create a new Git repository containing SVN history for trunk.

    git svn clone [svn-url]/trunk [new-git-repo]
    cd [new-git-repo]

    where [svn-url] is the SVN URL you copied in step 3 of the previous section and [new-git-repo] is the directory of your new Git repository. For example:

    git svn clone https://svn-123.prod.hosting.acquia.com/example/trunk master

  2. To add the Acquia Cloud Git repository as a remote, enter the following command:

    git remote add [remote-name] [your-new-Git-URL]

    where:

    • remote-name is the name you choose to give to your Acquia remote repository. Some examples are upstream or origin. This name refers to a specific remote repository. Git allows you to add multiple remote repositories to a single local repository, and each one gets its own name. If you are working with a single remote repository, origin is a standard name.
    • your-new-git-URL is the new Git URL for your repository, which you can find in the Application Information panel on the Environments page.
  3. Pull changes from the Acquia Cloud Git repository, which only contained the initial "welcome" text file, into the local repository. Then remove those files, in order to start with a clean local repository into which you can commit code. For example, assuming you've named your remote repository origin:

    git pull origin master
    git rm docroot/index.html docroot/acquialogo.gif
    git commit -m 'remove initial welcome files'
  4. Push the repository to Acquia Cloud, using the following command:

    git push origin master

Deploying from your new Git repository

At this point, you have switched your Acquia Cloud application from SVN to Git and set up your Git repository. Your Acquia Cloud environments are still pointing to their old SVN branches and tags, and the environment cards on the Environments page display No code deployed.

No code deployed

You need to configure your environments to point to a Git branch or tag. To do so:

  1. On the Environments page, click the code switch button for an environment.

    The code switch button on the Environments page

  2. In the Switch code dialog, select the branch or tag that you want to deploy to the environment and click Continue.
  3. Click Switch to confirm.

Once you have deployed a Git branch or tag on an environment, it now points to the code base in your Git repository.

Related topics

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.

Contact supportStill need assistance? Contact Acquia Support