-
Log in to your local development system, or switch to, the [Magento file system owner]({{ page.baseurl}}/cloud/before/before-workspace-file-sys-owner.html).
-
Change to a directory to which the Magento file system owner has write access.
-
Enter the following command in a terminal to log in to your project:
magento-cloud login -
List your projects. With the project ID, you can complete additional commands.
magento-cloud project:list -
If necessary, clone the project to your local. You should have cloned when setting up your local development workspace.
magento-cloud project:get <project ID> -
Change to a project directory. For example,
cd /var/www/html/magento2 -
List environments in the project. Every environment includes an active Git branch of your code, database, environment variables, configurations, and services.
magento-cloud environment:listmagento-cloud environment:listdisplays environment hierarchies whereasgit branchdisplays does not. If you have any nested environments, usemagento-cloud environment:listto see the full list. -
Fetch origin branches to get the latest code:
git fetch origin -
Check out, or switch to, a specific branch and environment. Git commands only checkout the Git branch. The Magento Cloud command also switches to the active environment.
magento-cloud environment:checkout <environment ID>To create a new environment, use
magento-cloud environment:branch <environment name> <parent environment ID> -
Pull any updated code to your local for the environment ID (which is the Git branch):
git pull origin <environment ID> -
Create a snapshot of the environment as a backup:
magento-cloud snapshot:create -e <environment ID>