如何获得 gitlab.com 的根证书

How to get root certifiacte for gitlab.com

我正在尝试获取 gitlab.com 的根证书,以便我可以使用 GitLab API 从存储库下载 files/build 工件(我需要这个,因为来自 IoT 的 HTTPS 身份验证设备)。
对于 GitHub,我使用了以下命令,由 MCU 制造商为 OTA 提供:

echo "" | \
openssl s_client -showcerts -connect api.github.com:443 | \
sed -n "1,/Root/d; /BEGIN/,/END/p" | openssl x509 -outform PEM

然而,同样的(将api.github替换为gitlab.com)并没有获得根证书。我是初学者,请大家帮忙

issue 15364,您应该能够看到根 CA(和 2 个中间 CA):

echo | openssl s_client -connect gitlab.com:443 -showcerts
depth=2 C = US, ST = New Jersey, L = Jersey City, O = The USERTRUST Network, CN = USERTrust RSA Certification Authority
verify return:1
depth=1 C = GB, ST = Greater Manchester, L = Salford, O = Sectigo Limited, CN = Sectigo RSA Domain Validation Secure Server CA
verify return:1
depth=0 CN = gitlab.com
verify return:1
CONNECTED(00000005)
---
Certificate chain
 0 s:CN = gitlab.com
   i:C = GB, ST = Greater Manchester, L = Salford, O = Sectigo Limited, CN = Sectigo RSA Domain Validation Secure Server CA
-----BEGIN CERTIFICATE-----
<snip>                         <<<<====== Root CA
-----END CERTIFICATE-----
 1 s:C = GB, ST = Greater Manchester, L = Salford, O = Sectigo Limited, CN = Sectigo RSA Domain Validation Secure Server CA
   i:C = US, ST = New Jersey, L = Jersey City, O = The USERTRUST Network, CN = USERTrust RSA Certification Authority
-----BEGIN CERTIFICATE-----
<snip>
-----END CERTIFICATE-----
 2 s:C = US, ST = New Jersey, L = Jersey City, O = The USERTRUST Network, CN = USERTrust RSA Certification Authority
   i:C = GB, ST = Greater Manchester, L = Salford, O = Comodo CA Limited, CN = AAA Certificate Services
-----BEGIN CERTIFICATE-----
<snip>
-----END CERTIFICATE-----