Reputation: 10303
Following this Quickstart I set a default project like this
$ gcloud config set project lfs258
Updated property [core/project].
$ gcloud config get-value project
lfs258
The project lfs258 doesn't exist on my GCP account, though, so I'm surprised that I could set it as the default. When I try to see where gcloud stores its defaults there is no .gcloud/
directory.
Where does gcloud store its defaults? kubectl
stores them in .kube/config
but I can't find a similar config file for gcloud.
Upvotes: 30
Views: 23574
Reputation: 6872
To those using quicklabs the default configuration is stored at:
/tmp/tmp.KeT141EpoV/configurations/config_cloudshell-5880
In order to find the correct location, please refer to @Devi answer
Upvotes: -1
Reputation: 10189
To be more generic, you can always run gcloud info
to print out a bunch of diagnostics information to display all the configuration files and locations as well as logs and much more. Below is the gcloud info
output on my environment, as you can see the configuration files are in
User Config Directory: section.
$ gcloud info
Google Cloud SDK [239.0.0]
Platform: [Mac OS X, x86_64] ('Darwin', 'foorbar.local', '18.2.0', 'Darwin Kernel Version 18.2.0: Thu Dec 20 20:46:53 PST 2018; root:xnu-4903.241.1~1/RELEASE_X86_64', 'x86_64', 'i386')
Python Version: [2.7.15 (default, Nov 27 2018, 21:40:55) [GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5)]]
Python Location: [/usr/local/opt/python@2/bin/python2.7]
Site Packages: [Enabled]
Installation Root: [/Users/devy/.google-cloud-sdk]
Installed Components:
kubectl: [2019.03.17]
core: [2019.03.17]
gcloud: []
docker-credential-gcr: []
gsutil: [4.37]
bq: [2.0.42]
alpha: [2019.02.22]
System PATH: [REDACTED]
Python PATH: [REDACTED]
Cloud SDK on PATH: [True]
Kubectl on PATH: [/usr/local/bin/kubectl]
Installation Properties: [/Users/devy/.google-cloud-sdk/properties]
User Config Directory: [/Users/devy/.config/gcloud]
Active Configuration Name: [default]
Active Configuration Path: [/Users/devy/.config/gcloud/configurations/config_default]
Account: [[email protected]]
Project: [foo-bar]
Current Properties:
[core]
project: [foo-bar]
account: [[email protected]]
disable_usage_reporting: [True]
[container]
cluster: [foobar]
[compute]
region: [us-central1]
zone: [us-central1-a]
Logs Directory: [/Users/devy/.config/gcloud/logs]
Last Log File: [/Users/devy/.config/gcloud/logs/2019.03.19/16.39.09.777341.log]
git: [git version 2.19.1]
ssh: [OpenSSH_7.9p1, LibreSSL 2.7.3]
In this particular case, you can run gcloud info | grep 'User Config'
to list the location of the config files, regardless if you custom install it or not.
Upvotes: 20
Reputation: 8980
To be more specific gcloud
supports multiple configurations. Run
gcloud config configurations list
to see full list.
If user did not create configuration explicitly he/she gets configuartion named default
, and as a result properties set via
gcloud config set ...
command will get stored in
~/.config/gcloud/configurations/config_default
If you create new configuration
gcloud config configurations create my_settings
then properties will be stored in
~/.config/gcloud/configurations/config_my_settings
Note as a user you should not care where they are stored, and if you need to programatically access them a better option is to run
gcloud config list --format=json
you can even access specific configuration (not just currently selected) by doing
gcloud config list --format=json --configuration=my_setting
Upvotes: 37
Reputation: 4324
It is stored in ~/.config/gcloud/configurations/config_default
Upvotes: 6