簡體   English   中英

Git: SSL 證書問題:無法獲取本地頒發者證書

[英]Git: SSL certificate problem: unable to get local issuer certificate

我用的是git,用的是GitLab,一切正常,直到前幾天開始出現SSL證書問題錯誤:

PS C:\proj> git clone https://git.company.com/dev/myproject.git
Cloning into 'myproject'...
fatal: unable to access 'https://git.company.com/dev/myproject.git/': 
       SSL certificate problem: unable to get local issuer certificate

據我了解,停用 SSL 驗證是一個安全問題,因此我喜歡設置http.sslverify false的解決方案。

問題類似於這個 找到的解決方案是將http.sslCAInfo設置為C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt ",該解決方案對我不起作用。

有人可以用簡單的話解釋一下:

  • 那.crt 證書是什么(我想這是為了本地和遠程 git 服務器之間的安全握手?),
  • 如何正確獲取該證書
  • 將它保存在開發機器上的什么地方
  • 如何配置 git 以使用它
  • 在這種情況下,SSH 和 SSL 之間有什么區別。

附言。 按照 VonC 的回答,我得到了建議的版本 output

在此處輸入圖像描述

您需要為您的公司站點獲取證書鏈(中間和根 CA)。

在 git bash session 中,如下所示

echo | openssl s_client -connect git.company.com:443 -servername git.company.com -showcerts | openssl crl2pkcs7 -nocrl | openssl pkcs7 -noout -print_certs

從那里,你需要

  • 將它們保存在file.crt
  • 在全局 git 配置中引用該文件

那是:

git config --global http."https://*.comany.com/".sslcainfo "C:\path\to\file.crt"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM