0 votes
1 view
in GCP by (18.3k points)

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.

1 Answer

+1 vote
by (48.8k points)

1)To make sure you are authenticated with the correct account, type the following command:

gcloud auth list

* account 1

  account 2

2)To shift(change) to the project's account if not:

gcloud config set account `ACCOUNT`

3)Depending on the chosen account, the project list will be different, to check the project list, type the following command:

gcloud projects list

- project 1

- project 2

4)Switch to the intended project:

gcloud config set project `PROJECT NAME`

...