Information for: DEVELOPERS   PARTNERS   SUPPORT

Configuring repository mirroring in Code Studio

Repository mirroring is a native Git feature that can be implemented through any CI tool including Code Studio. This page outlines the steps to set up repository mirroring with common Git-based code repositories.

After you set up your Code Studio account and configure your workflow, complete the following instructions to set up repository mirroring with BitBucket:

Note

If you want Code Studio to pull code from a private BitBucket repository, you must authenticate Code Studio with BitBucket. There are many ways to do this. Acquia recommends following this tutorial.

  1. In Bitbucket:

    1. Create and commit a bitbucket-pipelines.yml file.

    2. Push the yml file to Bitbucket.

      This runs the pipeline and fails.

    3. In the Bitbucket user interface, go to your repository and click Settings.

    4. In the Pipelines section, click SSH keys.

    5. Generate a new SSH key or upload your own SSH key.

    6. Copy the resulting public key to your clipboard.

    7. In the Known Hosts section on the same page, enter gitcode.acquia.com.

    8. Click Fetch and then add host.

  2. In Code Studio:

    1. Log in to the Code Studio interface using http://code.acquia.com/ or the link provided upon creation in the Cloud IDE.

    2. Navigate to the respective Code Studio project.

    3. Click Settings > Repository > Deploy Keys.

    4. In the Key field, paste the public key that you generated in Bitbucket.

    5. In the Name field, enter a name for the key.

    6. Select the Write access allowed checkbox.

    7. Click Add key.

      The system adds the key.

  3. In Bitbucket:

    1. Review the following yml file example and adjust the code to your needs:

      clone:
        depth: full
      pipelines:
        default:
          - step:
            script:
              - git branch
              - git push --force [email protected]:<CLIENT_GROUP>/<ACQUIA_PROJECT> $BITBUCKET_BRANCH
      
    2. Add the code to your bitbucket-pipelines.yml file.

    3. Commit the file.

      A pipeline process starts. This time it should succeed.

Any subsequent commits and creation/deletion of a branch are mirrored to Code Studio.

Note

This only mirrors git history. It does not mirror any metadata generated in BitBucket such as issues and comments in PRs.