gcloud config set: Project, Region & Common CI Errors
Set the active project, region, and zone gcloud uses by default.
gcloud config set writes default properties - most importantly the project, plus compute region and zone - so you do not repeat them on every command. CI usually sets the project right after authenticating.
What it does
gcloud config set <property> <value> stores a default in the active configuration (e.g. core/project, compute/region). Subsequent commands inherit these unless overridden by a flag. Named configurations (gcloud config configurations) let you switch whole sets of defaults between projects/environments.
Common usage
# Set the active project (most common)
gcloud config set project my-project
# Set default region and zone
gcloud config set compute/region us-central1
gcloud config set compute/zone us-central1-a
# Inspect current config
gcloud config listCommon error in CI: "The required property [project] is not currently set"
Commands fail with "ERROR: (gcloud) The required property [project] is not currently set" when no project default exists and none was passed - common right after activating a service account. Fix: run gcloud config set project <id> (or pass --project on each command, or set CLOUDSDK_CORE_PROJECT). Note the project ID is not the display name and not the numeric project number - use the lowercase ID. A "permission denied" instead of "not set" means the identity lacks roles on that project.
Key properties
| Property | Purpose |
|---|---|
| project | Active GCP project ID |
| compute/region | Default region |
| compute/zone | Default zone |
| account | Active credentialed account |
| config list | Show all current settings |