The environment "main" is not currently active

I created a new project and tried to use the Platform CLI to SSH into my project’s environment via platform ssh and received the following warning message.

Could not find applications: the environment "main" is not currently active.

You will receive that error on a created project that has not yet been initialized with a code base.

The main environment is automatically activated when you push your code to it, so run the following commands from your local project repository:

  • Set as remote

    $ platform project:set-remote <project ID>
    Setting the remote project for this repository to: myapp (<project ID>)

    You can retrieve your <project ID> with the command platform project:list.

  • Push to

    If you have not already initialized a Git repository for your project, first run git init. Then,

    $ git add .
    $ git commit -m "Moving to"
    $ git push platform main
  • When the build process has completed you can SSH into master with:

    $ platform ssh

If in the future you add and push a development branch to, unlike master that branch dev will not automatically be activated. In order to SSH into dev, you can activate it from within your local project directory using

$ git checkout dev
$ platform environment:activate