【问题标题】:gsutil results in "CommandException: You have multiple types of configured credentials"gsutil 导致“CommandException:您有多种类型的配置凭据”
【发布时间】:2014-11-01 01:19:07
【问题描述】:

我正在尝试运行 gsutil 命令来列出 Google Cloud Storage 上存储桶中的内容。我几乎可以肯定该命令没有任何问题。

我得到的错误是:

CommandException: You have multiple types of configured credentials (['Oauth 2.0 User Account', 'OAuth 2.0 Service Account']), which is not supported. For more help, see "gsutil help creds".

我已阅读“gsutil help creds”中的详细信息,但其中仅包含四种凭据类型的高级定义,没有帮助。

阅读错误消息,似乎我基本上需要删除“已配置凭据”之一,在这种情况下,我想删除“Oauth 2.0 用户帐户”凭据。并使用“OAuth 2.0 服务帐号”。

因此,我查看了包含自动生成的配置凭据的“.boto”文件,但看起来没有可以编辑的 Oauth 2.0 用户帐户。

我还尝试在 Google 的开发者控制台中挖掘以删除 Oauth 2.0 用户帐户,但我无法做到。

基本上,我的问题(假设它是正确的问题),如何删除 Google Cloud Platform 中的“Oauth 2.0 用户帐户”凭据?

【问题讨论】:

    标签: oauth google-oauth google-cloud-storage gsutil google-cloud-platform


    【解决方案1】:

    请运行:

    gsutil -D

    调试输出将包括 config_file_list,它应该向您显示多个凭据的定义位置。

    您是否使用 Google Compute Engine 运行?发生此问题的常见方式是当 GCE 已经创建服务帐户凭据(在 /etc/boto.cfg 中)时,用户在 ~/.boto 中为 gsutil 配置凭据(使用 gsutil config)

    【讨论】:

    • 谢谢!这帮助我弄清楚了这个问题。该输出有一个列表:config_file_list,它读取的其中一个配置似乎是我过去设置的旧配置。包含旧配置的目录是:/.config/gcloud/legacy_credentials/[MY_EMAIL_ADDRESS]/.boto 我完全删除了目录legacy_credentials,这解决了问题。
    • 在我的情况下(即 MacOS),我也删除了用户目录中的 .boto 文件:/Users/{your_user}/.boto
    【解决方案2】:

    您是否尝试运行gcloud auth

    Usage: gcloud auth [optional flags] <command>
      command may be         activate-refresh-token | activate-service-account |
                             list | login | revoke
    
    Manage oauth2 credentials for the Google Cloud SDK.
    
    optional flags:
      --format FORMAT        Format for printed output.
      --help                 Display detailed help.
      --project PROJECT      Google Cloud Platform project to use for this
                             invocation.
      --quiet, -q            Disable all interactive prompts.
      -h                     Print a summary help and exit.
    
    commands:
      activate-refresh-token
                             Get credentials via an existing refresh token.
      activate-service-account
                             Get credentials via the private key for a service
                             account.
      list                   List the accounts for known credentials.
      login                  Get credentials for the tools in the Google Cloud SDK
                             via a web flow.
      revoke                 Revoke authorization for credentials.
    

    【讨论】:

      猜你喜欢
      • 2015-05-29
      • 2018-06-01
      • 2021-11-05
      • 1970-01-01
      • 1970-01-01
      • 2015-02-15
      • 2021-09-24
      • 2019-03-13
      • 2016-06-30
      相关资源
      最近更新 更多