GitHub integration

The GitHub integration enables you to manage your Adobe Commerce on cloud infrastructure environments directly from your GitHub repository. The integration manages content already in GitHub and synchronizes it with Adobe Commerce. Before you begin, your project and environments must be in a GitHub repository.


We strongly recommend using a private repository for your Adobe Commerce on cloud infrastructure project to protect any proprietary information or development work, such as extensions and sensitive configurations.

This integration enables you to:

  • Create an environment when you create a branch
  • Redeploy the environment when you merge a pull request
  • Delete the environment when you delete the branch

You must obtain a GitHub token and a webhook to continue the process.

Generate a GitHub token

You must be a member of a group with write-access to the GitHub repository, so that you can push to the repository. See GitHub: Create.

Prepare your repository

Clone your Adobe Commerce on cloud infrastructure project from an existing environment and migrate the project branches to a new, empty GitHub repository, preserving the same branch names. It is critical to retain an identical Git tree, so that you do not lose any existing environments or branches in your Adobe Commerce on cloud infrastructure project.

  1. From the terminal, log in to your Adobe Commerce on cloud infrastructure project.

    magento-cloud login
  2. List your projects and copy the project ID.

    magento-cloud project:list
  3. Clone the project to your local environment.

    magento-cloud project:get <project-ID>
  4. Add your GitHub repository as a remote.

    git remote add origin<user-name>/<repo-name>.git

    The default name for the remote connection may be origin or magento. If origin exists, you can choose a different name or you can rename or delete the existing reference. See git-remote documentation.

  5. Verify that you added the GitHub remote correctly.

    git remote -v

    Expected response:

    origin<user-name>/<repo-name>.git (fetch)
    origin<user-name>/<repo-name>.git (push)
  6. Push the project files to your new GitHub repository. Remember to keep all branch names the same.

    git push -u origin master

    If you are starting with a new GitHub repository, you may have to use the -f option, because the remote repository does not match your local copy.

  7. Verify that your GitHub repository contains all of your project files.

Enable the GitHub integration

The following enables the GitHub integration and provides a Payload URL to use when creating a webhook.


The following command overwrites all code in your Adobe Commerce on cloud infrastructure project with code from your GitHub repository. This includes all branches, including the production branch. This action happens instantly and cannot be undone. As a best practice, it is important to clone all of your branches from your Adobe Commerce on cloud infrastructure project and push them to your GitHub repository before adding the GitHub integration.

To enable the GitHub integration:

  1. Enable the integration.

    magento-cloud integration:add --type=github --project=<project-ID> --token=<your-GitHub-token> {--repository=USER/REPOSITORY | --repository=ORGANIZATION/REPOSITORY} [--build-pull-requests={true|false} --fetch-branches={true|false}
    • <project-ID>—Your Adobe Commerce on cloud infrastructure project ID
    • <your-GitHub-token>—The personal access token you generated for GitHub
    • --repository=USER/REPOSITORY—Your personal GitHub repository name
    • --repository=ORGANIZATION/REPOSITORY—The organization repository name
    • --build-pull-requests—An optional parameter that instructs Adobe Commerce on cloud infrastructure to deploy after you merge a pull request (true by default)
    • --fetch-branches—An optional parameter that causes Adobe Commerce on cloud infrastructure to track branches and deploy after you update a branch (true by default)

    Example 1: Enable the GitHub integration for a personal, private repository:

    magento-cloud integration:add --type=github --project=ov58dlacU2e --token=<token> --repository=myUserName/myrepo

    Example 2: Enable the GitHub integration for an organization repository:

    magento-cloud integration:add --type=github --project=<project-id> --token=<token> --repository=Magento/teamrepo
  2. Enter the required information when prompted.

  3. Copy the Payload URL displayed by the return output.

    Created integration wp2f2thlmxwcg (type: github)
    Repository: myUserName/myrepo
    Build PRs: yes
    Fetch branches: yes
    Payload URL:<project-id>/integrations/wO8a0eoamxwcg/hook

Add the webhook in GitHub

In order to communicate events—such as a push—with your Cloud Git server, you must create a webhook for your GitHub repository:

  1. In your GitHub repository, click the Settings tab.

  2. In the left navigation bar, click Webhooks.

  3. In the Webhooks pane, click Add webhook.

  4. In the Webhooks/Add webhook form, edit the following fields:

    • Payload URL: Enter the URL returned when you enabled the GitHub integration.
    • Content type: Choose application/json from the list.
    • Secret: Enter a verification secret.
    • Which events would you like to trigger this webhook?: Select Send me everything.
    • Select the Active checkbox.
  5. Click Add webhook.

Test the integration

After configuring the GitHub integration, you can verify that the integration is operational using the magento-cloud CLI:

magento-cloud integration:validate

Or you can test it by pushing a simple change to your GitHub repository.

  1. Create a test file.

  2. Commit and push the change to your GitHub repository.

    git add . && git commit -m "Testing GitHub integration" && git push
  3. Log in to the Project Web Interface and verify that your commit message is displayed and your project deploying.

Remove the integration

You can safely remove the GitHub integration from your project without affecting your code.

To remove the GitHub integration:

  1. From the terminal, log in to your Adobe Commerce on cloud infrastructure project.

  2. List your integrations. You need the GitHub integration ID to complete the next step.

    magento-cloud integration:list
  3. Delete the integration.

    magento-cloud integration:delete <int-ID>

Also, you can remove the GitHub integration by logging in to your GitHub account and removing the web hook in the Webhooks tab of the repository Settings.

On this page