Google Cloud Platform
Cloud SDK

gcloud Tool Guide

gcloud command-line tool (installed together with Google Cloud SDK) can be used to manage both your development workflow and your Google Cloud Platform resources.

This guide describes development workflow related commands of gcloud tool, while the resource management commands (like gcloud compute for Google Compute Engine resources, or gcloud sql for Google Cloud SQL resources) can be found in Cloud Platform Tools guide.


To download and install the gcloud command-line tool, follow the Cloud SDK Installation and Quick Start instructions.


Accessing help

Simple usage guidelines are available by adding -h onto the end of any gcloud invocation. For example:

$ gcloud -h
Usage: gcloud [optional flags] <group | command>
  group may be           auth | beta | components | compute | config | container
                         | deployment-manager | dns | sql | topic
  command may be         docker | feedback | help | info | init | version

The *gcloud* CLI manages authentication, local configuration, developer
workflow, and interactions with the Google Cloud Platform APIs.

optional flags:

command groups:


More verbose help can be obtained by appending --help flag, or executing gcloud help COMMAND. For example, gcloud init --help and gcloud help init commands are equivalent—both give long, detailed help.

Back to top

Setting up gcloud

Run gcloud init to get started. Running gcloud init does the following:

  • Authenticates the user (or allows the user to re-use previously saved credentials).
  • Asks for the user's project and saves it as a config setting.
  • Sets a default zone and region based on the project’s metadata if available, and prompts the user for this information if not. Saves this information as a config setting.
  • Prompts you to clone the listable Cloud-hosted Git repositories associated with the selected Google Cloud Platform project. (See Initializing a local Git repository for instructions on how to clone manually.)

See gcloud compute for a detailed overview of the gcloud init workflow.

Back to top

Additional gcloud configuration

This section describes some alternatives for users that have an existing configuration. For full details on gcloud commands, see the gcloud reference.

Managing authentication and credentials

As described in Setting up gcloud, running gcloud init accomplishes multiple things, one of which is authenticating the user. If you only want to authenticate, not set up gcloud, you can do so as follows:

gcloud auth login

You use the gcloud auth command group to manually manage your OAuth2 credentials for the Google Cloud SDK. For details, see gcloud auth.

Using beta commands

In addition to regular commands, the Google Cloud SDK offers a number of additional commands under the beta command group. Such commands are experimental and may be subject to change or even removal without warning in future releases.

A command labled beta is not necessarilly a reflection of the stability of the underlying service.

Configuring components

All tools in the Cloud SDK share some common configuration information. As described in Setting up gcloud, the gcloud init command sets up a default configuration for you. You use gcloud config to manage that configuration; see gcloud config for details.

Using multiple configurations

The default configuration set up by gcloud init should be sufficient for most users. However, gcloud also lets you create named configurations that you can switch between on a per-command basis. This is helpful if you have multiple accounts, for example, and you want to create a configuration for each of them.

For a discussion of default zones (relevant for gcloud compute users), see gcloud compute. For more information about using named configurations, see gcloud topic configurations.

Initializing a local Git repository

As described in Setting up gcloud, running gcloud init accomplishes multiple things, one of which is initializing a local Git repository. If you only want to initialize a local Git repository, not set up gcloud, you can do so as follows:

gcloud source repos clone default local-directory-name

Back to top