Search code examples
authenticationgoogle-cloud-storagegcloudgsutil

Your credentials are invalid. Please run $ gcloud auth login


gsutil was working as a stand-alone on my system. Then I installed SDK, including some authentication stuff. Now gsutil says my credentials are invalid.

$ gcloud auth login wolfvolpi@gmail.com
WARNING: `gcloud auth login` no longer writes application default credentials.
If you need to use ADC, see:
  gcloud auth application-default --help

You are now logged in as [redacted].
Your current project is [redacted].  You can change this setting by running:
  $ gcloud config set project PROJECT_ID
$ gsutil ls
Your credentials are invalid. Please run
  $ gcloud auth login

How to set my credentials so that gsutil runs again?

$ gcloud version
Google Cloud SDK 146.0.0
core 2017.02.28
core-nix 2017.02.28
gcloud 
gcloud-deps 2017.02.28
gcloud-deps-linux-x86_64 2017.02.28
gsutil 4.22
gsutil-nix 4.22

Solution

  • If you previously had gsutil configured with credentials, it is possible that it is picking up those old credentials that will no longer work in the Cloud SDK mode. Take a look in your boto file (typically at ~/.boto) and remove any credentials found in there.

    You can see the list of the valid fields in the boto file here: https://cloud.google.com/storage/docs/gsutil/commands/config#additional-configuration-controllable-features