执行sudo apt update时出现cloud-sdk未签名GPG错误,求解决方案
apt update Got it, this is a super common hiccup when your system doesn’t have the right public key to verify the Google Cloud SDK repository. Let’s walk through the fix step by step:
First, download the official Google Cloud public key and add it to your system’s dedicated keyring (this is the modern, secure way instead of using the old
apt-keydefault ring):curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -If
curlisn’t installed on your system, usewgetinstead:wget -q -O - https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -Next, update your Cloud SDK repository configuration to tell
aptto use this new keyring for verification. Open the repository file with your favorite text editor (I’ll usenanohere):sudo nano /etc/apt/sources.list.d/google-cloud-sdk.listFind the line that looks like this:
deb http://packages.cloud.google.com/apt cloud-sdk mainReplace it with this line (the
signed-byflag points to the key we just added):deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk mainSave and exit the editor (for
nano, pressCtrl+O, thenEnter, thenCtrl+X).Finally, run
apt updateagain to confirm the error is gone:sudo apt update
That should resolve the "NO_PUBKEY B53DC80D13EDEF05" and "repository is not signed" errors. The key here is making sure apt knows exactly which key to use for verifying the Cloud SDK repo, which we set up with the signed-by parameter.
内容的提问来源于stack exchange,提问作者dwightjl

