You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Elementary OS 6.1安装gcloud CLI后apt更新GPG密钥错误求解

问题描述

我在基于Ubuntu 20.04的Elementary OS 6.1系统上安装gcloud CLI,安装过程看似正常,但执行sudo apt update时,仓库出现GPG密钥验证错误:

Err:21 https://packages.cloud.google.com/apt cloud-sdk InRelease
The following signatures could not be verified because their public key is not available: NO_PUBKEY B53DC80D13EDEF05

W: GPG error: https://packages.cloud.google.com/apt cloud-sdk InRelease: The following signatures could not be verified because their public key is not available: NO_PUBKEY B53DC80D13EDEF05
E: The repository “https://packages.cloud.google.com/apt cloud-sdk InRelease” is not signed.

尝试执行以下命令修复但无效:

curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
解决方法
  • 手动导入缺失的GPG密钥
    直接从Ubuntu密钥服务器获取并导出目标密钥到指定密钥环:

    gpg --keyserver keyserver.ubuntu.com --recv-keys B53DC80D13EDEF05
    gpg --export --armor B53DC80D13EDEF05 | sudo tee /usr/share/keyrings/cloud.google.gpg > /dev/null
    
  • 修正仓库配置文件
    确保Google Cloud SDK的仓库配置正确引用密钥环:

    1. 打开配置文件:
      sudo nano /etc/apt/sources.list.d/google-cloud-sdk.list
      
    2. 将内容修改为:
      deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main
      
    3. 保存退出后,更新仓库:
      sudo apt update
      
  • 一键安装脚本备选方案
    如果上述方法仍未解决,使用官方提供的一键安装脚本绕过仓库配置问题:

    curl https://sdk.cloud.google.com | bash
    

    安装完成后,重启终端或执行source ~/.bashrc(zsh用户执行source ~/.zshrc)加载环境变量。


内容的提问来源于stack exchange,提问作者Pedro Castro

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.07 15:47:44