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

Ubuntu 22.04添加git-core PPA遇证书过期错误,求排查方向

解决Ubuntu 22.04添加git-core/ppa时的证书过期问题

排查过期证书的方法

你可以直接手动检查Launchpad API服务器的证书链,定位具体过期的证书:
执行以下命令:

openssl s_client -connect api.launchpad.net:443

在输出内容里找到Certificate chain区块,每个证书条目会包含Not Before(生效时间)和Not After(过期时间)字段,对比系统当前时间就能找出过期的证书。

常见解决办法

1. 确认系统时间准确

证书验证依赖正确的系统时间,先同步时间:

sudo timedatectl set-ntp true

等待几秒后再尝试添加PPA。

2. 重新安装httplib2

旧版本的python3-httplib2可能存在CA证书路径识别问题,重装可修复:

sudo apt install --reinstall python3-httplib2

3. 临时指定CA证书路径

如果上述方法无效,手动指定系统CA证书路径后再执行命令:

export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
sudo add-apt-repository ppa:git-core/ppa

4. 手动添加PPA源(绕过add-apt-repository的证书问题)

直接创建PPA源文件并导入GPG密钥:

  1. 创建源列表文件:
sudo nano /etc/apt/sources.list.d/git-core-ppa.list
  1. 写入以下内容并保存:
deb http://ppa.launchpad.net/git-core/ppa/ubuntu jammy main
deb-src http://ppa.launchpad.net/git-core/ppa/ubuntu jammy main
  1. 导入PPA的GPG密钥:
curl -fsSL https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xE1DD270288B4E6030699E45FA1715D88E1DF1F24 | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/git-core-ppa.gpg
  1. 更新软件源:
sudo apt update

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.20 19:38:11