Google Cloud Storage - switch projects
There are two ways to do this.
First, you could repeat the gsutil setup. Just run gsutil config
.
Alternatively, if you don't want to run through setup again, gsutil's config lives in a file called .boto
. In Linux, it'll be in your home directory. It's a readable config file. Open it up, scroll down to the line default_project_id =
, and change the project after the equals sign.
Edit: I missed that you were using gsutil as part of the gcloud suite. My suggestion only applies if you've installed gsutil directly. Travis's suggestion is the right one if you have gcloud installed.
To change the default project that gcloud (and gsutil) use in a gcloud installation, you should do this:
gcloud config set project desired-project-id-here
You can view your current settings with gcloud config list
.
You can view all configurations available with gcloud config configurations list
.
You can then switch to an alternate configuration with gcloud config configurations activate [NAME]
For scripting, it's safer to set the project just for one gsutil call:
CLOUDSDK_CORE_PROJECT=your-project-id gsutil # ...
I got this fixed by running gcloud init
and following the commands to reinitialize the configuration.