Initializing the gcloud CLI Stay organized with collections Save and categorize content based on your preferences.
This page shows you how to initialize the gcloud CLI.
After you install the gcloud CLI, perform initial setup tasks by runninggcloud init. You can also rungcloud initto change your settings or create a new configuration.
gcloud init performs the following setup steps:
- Authorizes the gcloud CLI to use youruser account credentials to access Google Cloud, or lets you select anaccount if you have previously authorized access
- Sets up a gcloud CLIconfigurationand sets a base set ofproperties, includingthe active account from the step above, the current project, and ifapplicable, the default Compute Engine region and zone
You can run the following as alternatives togcloud init:
| Command | Description |
|---|---|
gcloud auth login | Authorize with a user account without setting up a configuration. |
gcloud auth activate-service-account | Authorize with a service account instead of a user account. Useful for authorizing non-interactively and without a web browser. |
gcloud config [COMMAND]gcloud config configurations [COMMAND] | Create and manage gcloud CLI configurations and properties. |
Initialize the gcloud CLI
To initialize the gcloud CLI:
Run
gcloud init:gcloud initIf you are in a remote terminal session, you can use the
--no-launch-browserflag to prevent the command from launching a browser-based authorizationflow, if required:gcloud init --no-launch-browserCreate or select a configuration if prompted.
If you are initializing a new gcloud CLI installation,
gcloud initcreates a configuration nameddefaultfor you and setsit as the active configuration. If you have existing configurations,gcloud initprompts you to choose between three options —re-initialize the active one, switch to another one and re-initialize it, orcreate a new one.Complete the authorization step when prompted.
Depending on whether you have previously authorized access toGoogle Cloud, you might be prompted to log in and grant access in aweb browser or to select an existing account.
If you used the
--no-launch-browserflag and login is required,you must then copy and paste the provided authorization URL into anotherbrowser window and follow the prompts provided.When this step is completed,
gcloud initsets theaccountproperty inthe configuration to the specified account.Choose a current Google Cloud project if prompted.
If you only have access to one project, including the default project foryour user account,
gcloud initselects it for you.Otherwise, you canselect a project from a list of projects for which you haveOwner,Editor orViewer permissions.
gcloud initsets theprojectproperty in the configuration to the property you choose. If you haveaccess to more than 200 projects, you will be prompted to entera project id, create a new project, or list projects. Note: If you choose to create a project, you'll also need toenable billing on your projectto use Google Cloud services.This account has a lot of projects! Listing them all can take a while. [1] Enter a project ID [2] Create a new project [3] List projectsPlease enter your numeric choice:
Choose a default Compute Engine zone if prompted.
If you don't have the Compute Engine API enabled or you alreadyhave a default zone in yourproject-level metadata, you will not see thisstep.
gcloud initsets theregionandzoneproperties in theconfiguration using the zone you choose.
To view the properties set through thegcloud init command, use thegcloud config list command.
[compute]region = us-east1zone = us-east1-b[core]account = dana@example.comdisable_usage_reporting = Falseproject = example-project
What's next
- To learn more about tool authorization,seeAuthorizing the gcloud CLI.
- To learn more about authorizing Application Default Credentials (ADC) forCloud Client Libraries (and Google API Client Libraries),seeSet up Application Default Credentials.
- To learn more about managing configurations,seegcloud CLI configurations.
- To learn more about managing properties,seegcloud CLI properties.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-18 UTC.