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.
The process for migrating from SVN to Git on Acquia Cloud Professional has three main steps:
- Enabling Git for your Acquia Cloud Professional application, using the Acquia Cloud interface.
- Setting up a local repository
- 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
- Sign in to the Acquia Cloud interface and select your application.
- 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.
- Click Application Info and copy the SVN URL to a text file or other location where you can retrieve it again.
- Contact Acquia Support to change your VCS from SVN to Git.
- 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.
- Create a new Git repository containing SVN history for trunk.
git svn clone [svn-url]/trunk [new-git-repo]
[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
- To add the Acquia Cloud Git repository as a remote, enter the following command:
git remote add [remote-name] [your-new-Git-URL]
remote-nameis the name you choose to give to your Acquia remote repository. Some examples are
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,
originis a standard name.
your-new-git-URLis the new Git URL for your repository, which you can find in the Application Information panel on the Environments page.
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
git pull origin master
git rm docroot/index.html docroot/acquialogo.gif
git commit -m 'remove initial welcome files'
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.
You need to configure your environments to point to a Git branch or tag. To do so:
- On the Environments page, click the code switch button for an environment.
- In the Switch code dialog, select the branch or tag that you want to deploy to the environment and click Continue.
- 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.