Skip to main content
Now you can run actions on your projects such as branching and merging. You can also simulate a local build of your codebase as if you were pushing a change to Upsun, including your services and data. Get a list of all available commands with:
upsun list
To get more information on a specific command, preface it with help:
upsun help get
You get output similar to the following:
Command: project:get
Aliases: get
Description: Clone a project locally

Usage:
 upsun get [-e|--environment ENVIRONMENT] [--depth DEPTH] [--build] [-p|--project PROJECT] [--host HOST] [-i|--identity-file IDENTITY-FILE] [--] [<project>] [<directory>]

Arguments:
  project                            The project ID
  directory                          The directory to clone to. Defaults to the project title

Select the right project and environment

When you are in an empty directory or a directory not associated with a specific Upsun project, if you run a command that requires a specific project and environment, you are prompted to select them. If your working directory is inside a local checkout of your project repository, your project and environment are detected automatically. You can always specify the project and environment in two ways:
  • As arguments for the command:
    upsun environment:info --project=my-project --environment=staging
    
  • With environment variables:
    export PLATFORM_PROJECT=my-project;
    export PLATFORM_BRANCH=staging;
    upsun environment:info
    
In multi-app projects, this applies also to selecting the right app (the environment variable would be PLATFORM_APPLICATION_NAME).

RootNotFoundException

If you check out a project via Git directly and not using the upsun get command, the CLI may be unable to determine what project it’s in. You might run a CLI command from within a project directory you’ve checked out and get an error like this:
[RootNotFoundException] Project root not found. This can only be run from inside a project directory.
Then the CLI hasn’t been able to determine the project to use. To fix this, run:
upsun project:set-remote --project PROJECT_ID
Replace PROJECT_ID with the ID of your project. You can find that in the Console or by running upsun projects to list all accessible projects.

Choose between the CLI and Git commands

Some CLI commands (especially many within the environment namespace) have some overlap with Git commands. Generally, they offer more options than the Git commands alone. For example, upsun push offers options such as --activate (to activate an environment before pushing) and --no-wait (so you can continue working without waiting for the push to complete). For all of them, you don’t need to configure a Git remote. It’s enough to have a project ID. An example of how this affects commands is that when you run upsun merge, it doesn’t affect your local codebase. You don’t even need the code locally. The code is only merged between environments remotely.

Run commands on your container

You can use the Upsun CLI to run commands on your container. You can use any command you’ve added in dependencies or a hook. The syntax looks like the following:
upsun ssh -- COMMAND ARGUMENTS
For example, to run a specific Python script named my-script.py on your current environment, run the following command:
upsun ssh -- python my-script.py
Or to use Drush to rebuild the cache on the feature environment, run this command:
upsun ssh -e feature -- drush -y cache-rebuild

Customize the CLI

You can customize how the CLI operates and what it returns with a configuration file (~/.upsun-cli/config.yaml) or environment variables. For details, see the customization instructions on GitHub.

Automate repetitive tasks

You might want to use the CLI in a script to automate repetitive tasks such as synchronizing your files locally. In such cases, you want to customize the CLI to bypass any confirmation questions. You can set the answer to every question as yes using the UPSUN_CLI_NO_INTERACTION environment variable. For instance, to locally sync every mount point for your app named myapp, you could use this command:
export PLATFORM_PROJECT=my-project;
export PLATFORM_BRANCH=main;
export UPSUN_CLI_NO_INTERACTION=1;
upsun mount:download --all --app app --target local-backup

Autocomplete commands

The CLI provides tab autocompletion for commands, options, and some values (your projects, valid regions). To enable autocompletion, follow this step:
Last modified on March 12, 2026