Initializing the gcloud CLI

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:

CommandDescription
gcloud auth loginAuthorize with a user account without setting up a configuration.
gcloud auth activate-service-accountAuthorize 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:

  1. Rungcloud init:

    gcloud init

    If 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-browser
  2. Create or select a configuration if prompted.

    If you are initializing a new gcloud CLI installation,gcloud init creates a configuration nameddefault for you and setsit as the active configuration. If you have existing configurations,gcloud init prompts you to choose between three options —re-initialize the active one, switch to another one and re-initialize it, orcreate a new one.

  3. 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-browser flag 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 init sets theaccount property inthe configuration to the specified account.

  4. Choose a current Google Cloud project if prompted.

    If you only have access to one project, including the default project foryour user account,gcloud init selects it for you.

    Otherwise, you canselect a project from a list of projects for which you haveOwner,Editor orViewer permissions.gcloud init sets 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.

    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:
    Note: If you choose to create a project, you'll also need toenable billing on your projectto use Google Cloud services.
  5. 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 init sets theregion andzone properties 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

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.