zuntan02のはてなブログ

備忘録的なものです。時々職場の技術者ブログにも転記してますが、メインはこちらで。

Ubuntu(WSL2の)でgit cloneしたらserver certificate verification failed

【概要】

Ubuntu/WSL2でgit cloneしたらけられた

fatal: unable to access 'https://ほげほげ': server certificate verification failed. CAfile: none CRLfile: none

【解決に至るメモ】

メッセージによれば証明書ファイルがないとのことなのでインストール

apt-get install --reinstall ca-certificates

→エラー

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-assets.heroku.com/apt ./ InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY <PUBKEY>

ググるとこのPUBKEYを取得しないといけないらしい

sudo  apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv <PUBKEY>
===
Executing: /tmp/apt-key-gpghome.zCUNU82Zet/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv <PUBKEY>
gpg: key <PUBKEY>: public key "Heroku Inc. <support@heroku.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1
===

再度証明書をインストール

apt-get install --reinstall ca-certificates

これでgit cloneできたよ