How to change the project in GCP using CLI commands

Ebin Davis picture Ebin Davis · Oct 16, 2017 · Viewed 162.8k times · Source

How can i change the current running project to another project in GCP (Google Cloud Platform) account using cli commands other than using gcloud init manually.

$gcloud projects list will list the projects running on my account. I want to change the current project to any other project from the list using a cli command.

Answer

Zachary Newman picture Zachary Newman · Oct 16, 2017
gcloud config set project my-project

You may also set the environment variable $CLOUDSDK_CORE_PROJECT.