The environment "master" 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 "master" is not currently active.

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

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

  • Set Platform.sh 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 Platform.sh

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

    $ git add .
    $ git commit -m "Moving to Platform.sh."
    $ git push platform master
    
  • 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 Platform.sh, 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