首页 > 解决方案 > `gsutlis ls` 无法显示存储桶列表

问题描述

我有 2 台 Mac 笔记本电脑。在这个问题中,我称它们为“MacA(工作正常)”和“MacB(奇怪的行为)”。

MacB发生了什么?

  1. 结果gsutils ls

    玛卡(工作正常)

    $ gsutil ls
    gs://bucket-a
    gs://bucket-b
    gs://bucket-c
    

    MacB(奇怪的行为)

    $ gsutil ls
    CommandException: Incorrect option(s) specified. Usage:
    
      gsutil ls [-a] [-b] [-d] [-l] [-L] [-r] [-p proj_id] url...
    
    For additional help run:
      gsutil help ls
    
  2. 结果gsutls help ls

    玛卡(工作正常)

    $ gsutil help ls
    NAME
      ls - List providers, buckets, or objects
    
    SYNOPSIS
    
      gsutil ls [-a] [-b] [-d] [-l] [-L] [-r] [-p proj_id] url...
    
    LISTING PROVIDERS, BUCKETS, SUBDIRECTORIES, AND OBJECTS
      If you run gsutil ls without URLs, it lists all of the Google Cloud Storage
      buckets under your default project ID (or all of the Cloud Storage buckets
      under the project you specify with the -p flag):
    
        gsutil ls
    
      If you specify one or more provider URLs, gsutil ls lists buckets at each
      listed provider:
      ......
    

    MacB(奇怪的行为)

    $ gsutil help ls
    CommandException: The help command accepts at most 2 arguments. Usage:
    
      gsutil help [command or topic]
    
    For additional help run:
      gsutil help help
    
  3. shasum ~/google-cloud-sdk/bin/gsutil

    ~/google-cloud-sdk/bin/gsutil 的校验和在 MacA 和 MacB 之间是相同的。

标签: google-cloud-platformgoogle-cloud-storagegsutil

解决方案


我解决了这个问题。

我的 .zshrc 配置错误。我删除了-g选项。

alias -g ls="ls -F -G"

↓</p>

alias ls="ls -F -G"

在我更改 .zshrc 之前,无意中gsutil ls 被替换为。gsutils ls -F -G


推荐阅读