repo init报error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed

repo init报error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed

  • [1 repo init出错的信息](#1 repo init出错的信息)
  • [2 解决方法](#2 解决方法)

在ubuntu执行repo init的时候报了repo init报error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed这种错误,解决方法是需要更新本地证书。问题现象以及解决方法如下所示:

1 repo init出错的信息

c 复制代码
Downloading Repo source from https://mirrors.tuna.tsinghua.edu.cn/git/git-repo
fatal: Cannot get https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/clone.bundle
fatal: error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)
fatal: double check your --repo-rev setting.
fatal: cloning the git-repo repository failed, will remove '.repo/repo'

2 解决方法

  • 安装证书
  • 更新本地证书
c 复制代码
sudo apt install ca-certificates
sudo update-ca-certificates --fresh
export SSL_CERT_DIR=/etc/ssl/certs