---
title: "Importing your codebase"
date: "2024-02-14T06:18:38+00:00"
summary: "Learn how to manually import your existing Drupal codebase into Cloud Platform using Git. Follow our step-by-step guide to prepare, transfer, and configure your application for seamless integration with Acquia's hosting environment."
image:
type: "page"
url: "/acquia-cloud-platform/importing-your-codebase"
id: "08c3bcca-f424-4093-aeca-0d9d9569ae72"
---

This page describes manually importing the codebase of an existing Drupal application into Cloud Platform using Git, as part of the process of [manually importing the entire application](/acquia-cloud-platform/create-apps/import/manual). For information about other methods of importing an application, see [Importing an existing application](/acquia-cloud-platform/create-apps/import).

To prepare and import your application’s codebase into a Cloud Platform code repository:

1.  Ensure your existing application’s most current Drupal code [docroot](/definitions/docroot) (the directory containing files and directories including Drupal’s `index.php`, `/includes` directory, and `/modules` directory) is on your local computer.
2.  Move any user-uploaded files directories (such as `/files`, `/sites/default/files`, or `/sites/[SITENAME]/files`) out of your `docroot` directory. There are separate [instructions for importing your user-uploaded files directories](manual-files.html). You must move the files because Cloud Platform stores files outside of your `docroot` to simplify management of your repository, and to guarantee file availability across redundant web nodes.
3.  Decide where to store your code repository on your local computer. The local code repository will contain the new `docroot` for the application you’re connecting to a Cloud Platform repository.
4.  The remote Cloud Platform code repository comes with a default `docroot` directory containing a placeholder file called `index.html`. To remove it and commit the change back to your repository, complete the following steps:
    1.  Go to the directory for the new local code repository for `docroot`, and then check out the current default application code repository contents to your computer.
        
            cd [LOCAL_REPOSITORY_DIRECTORY]
            git clone [REMOTE_REPOSITORY_URL]
            cd [SITENAME]
            git checkout master
        
        where:
        
        *   `[LOCAL_REPOSITORY_DIRECTORY]` is the directory for the new local code repository for your application’s `docroot`.
        *   `[REMOTE_REPOSITORY_URL]` is the URL of the Cloud Platform code repository. For help finding the Git URL of your application, see [Basic Git commands](/acquia-cloud-platform/develop-apps/repository/git#basic-git-commands).
        *   `[SITENAME]` is the name of your site on Cloud Platform. For more information about your sitename, see the [Sitename definition](/definitions/sitename) page.
    2.  In the new local code repository for the `docroot` directory, remove the default website and send the changes to Cloud Platform.
        
            git rm -r docroot
            git commit -m "Remove default docroot."
            git push origin master
        
5.  From the new local code repository directory, make a copy of your application’s most current `docroot` directory using the following command:
    
        cp -R [CURRENT_DOCROOT] docroot
    
    where `[CURRENT_DOCROOT]` is the complete path to the local location for the current `docroot` for your Drupal application.
    
6.  After you have imported your code, you should update your Drupal `settings.php` file to include required settings for Cloud Platform:
    
    a. Go to the Cloud Platform [Databases](/acquia-cloud-platform/manage-apps/database) page.
    
    1.  Click **PHP** to display the [require statement](/acquia-cloud-platform/manage-apps/code/require-line) for your database.
    2.  Add the previous `require` statement at the end of the `settings.php` file in your `/sites` directory.
    
    The database `require` statement causes your application to use a unique database for each Cloud Platform environment, which allows you to use the same `settings.php` file in each of your Cloud Platform environments.
    
7.  Commit the prepared Drupal `docroot` (without any `/files` directories) into your Cloud Platform repository:
    
        git add docroot
        git commit -m "Import my docroot."
        git push origin master
    

Next steps
----------

After your codebase is ready, [import your database](/acquia-cloud-platform/create-apps/import/manual/manual-db) and configure its website connection.