LinuxmacOSWindows

Where Does the gcloud CLI Store Its Config?

Where the gcloud CLI keeps configurations and credentials on each OS, and the two variables that move them.

Last updated

The gcloud CLI keeps named configurations, credentials, logs and properties in one config directory: ~/.config/gcloud on macOS and Linux, %APPDATA%\gcloud on Windows. Each named configuration is a file inside the configurations subfolder, so switching profiles never touches your actual project files.

Two things override the default. CLOUDSDK_CONFIG relocates the whole directory, and gcloud info prints the live path when you doubt everything. Check both before editing files by hand, since a set variable silently moves the target.

Where Google Cloud CLI stores this, by platform

Linux
~/.config/gcloud

Confirm with gcloud info --format='value(config.paths.global_config_dir)'. Named configs live in the configurations subfolder. Cloud Shell uses a temp folder that vanishes with the session, so export anything you need.

macOS
~/.config/gcloud

Same layout and same gcloud info command as Linux. Config files are plain text, but the auth subfolders hold refresh tokens, so treat copies like passwords.

Windows
%APPDATA%\gcloud

Paste %APPDATA%\gcloud into Explorer. Everything else (CLOUDSDK_CONFIG override, configurations subfolder, gcloud info check) works exactly as on Linux and macOS.

Frequently asked questions

How do I point gcloud at a different config directory?

Set CLOUDSDK_CONFIG to the directory you want before running any gcloud command. Everything (named configurations, auth, logs) follows that variable. It is the standard trick for isolated CI jobs and throwaway environments.

Can I copy the gcloud folder to another machine?

Yes for settings, carefully for secrets. Named configurations copy cleanly, but application default credentials and OAuth tokens are machine bound and usually need a fresh gcloud auth login on the new machine.

Notice an outdated path? Let us know.