![如何修复与 gh 相关的这个 apt 更新密钥环问题?](https://linux22.com/image/1190052/%E5%A6%82%E4%BD%95%E4%BF%AE%E5%A4%8D%E4%B8%8E%20gh%20%E7%9B%B8%E5%85%B3%E7%9A%84%E8%BF%99%E4%B8%AA%20apt%20%E6%9B%B4%E6%96%B0%E5%AF%86%E9%92%A5%E7%8E%AF%E9%97%AE%E9%A2%98%EF%BC%9F.png)
gh
我遇到了与(github 命令行)相关的错误。
$ sudo apt update
...
Get:3 https://cli.github.com/packages stable InRelease [3,917 B]
Err:3 https://cli.github.com/packages stable InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 23F3D4EA75716059
...
Fetched 338 kB in 2s (154 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://cli.github.com/packages stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 23F3D4EA75716059
W: Failed to fetch https://cli.github.com/packages/dists/stable/InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 23F3D4EA75716059
W: Some index files failed to download. They have been ignored, or old ones used instead.
它是安装命令是:
type -p curl >/dev/null || sudo apt install curl -y
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y
我认为这意味着与 /usr/share/keyrings/githubcli-archive-keyring.gpg 有关的问题。我已卸载gh
。
我该如何在期间消除这个问题sudo apt update
?
答案1
根据@muru的评论,我删除了文件/etc/apt/sources.list.d/github-cli.list
,,/etc/apt/sources.list.d/github-cli.list.distUpgrade
。/etc/apt/sources.list.d/github-cli.list.save
问题解决了。
边注:从 Ubuntu 20.04 升级到 22.04 后,我也发现了许多focal
(即 Ubuntu 20.04)文件/etc/apt/sources.list.d
。我也删除了这些旧文件。