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.
-
From the terminal, log in to your Adobe Commerce on cloud infrastructure project.
magento-cloud login
-
List your projects and copy the project ID.
magento-cloud project:list
-
Clone the project to your local environment.
magento-cloud project:get <project-ID>
-
Add your GitHub repository as a remote.
git remote add origin git@github.com:<user-name>/<repo-name>.git
The default name for the remote connection may be
origin
ormagento
. Iforigin
exists, you can choose a different name or you can rename or delete the existing reference. See git-remote documentation. -
Verify that you added the GitHub remote correctly.
git remote -v
Expected response:
origin git@github.com:<user-name>/<repo-name>.git (fetch) origin git@github.com:<user-name>/<repo-name>.git (push)
-
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. -
Verify that your GitHub repository contains all of your project files.