Tor*_*ass 25 git debian github
我刚刚在其中创建了一个github帐户和一个存储库,但在尝试使用推荐URL创建本地工作副本时
git clone https://github.com/<user>/<project>.git
Run Code Online (Sandbox Code Playgroud)
我得到一个错误
致命:无法访问' https://github.com/<user>/<project>.git ':服务器证书验证失败.CAfile:/home/<user>/.ssl/trusted.pem CRLfile:none
我在Debian Jessie,我本来希望Debian和GitHub都能提供/依赖一系列普遍接受的CA,但显然我的系统不信任GibHub的证书.
任何简单的方法来解决这个问题(没有经常推荐的"GIT_SSL_NO_VERIFY = true"黑客和类似的解决办法)?
编辑:
附加信息:
删除〜/ .ssl/trusted.pem时,git错误消息将更改为
fatal: unable to access 'https://github.com/tcrass/scans2jpg.git/': Problem with the SSL CA cert (path? access rights?)
Run Code Online (Sandbox Code Playgroud)编辑:
@ VonC关于git https.sslCAinfo选项的建议让我走上正轨 - 我刚刚将下载的cacert.org CA添加到我的trusted.pem,现在git不再抱怨了.
Von*_*onC 53
首先确保你的Debian上安装了证书/etc/ssl/certs.
如果没有,请重新安装:
sudo apt-get install --reinstall ca-certificates
Run Code Online (Sandbox Code Playgroud)
由于该包不包含根证书,请添加:
sudo mkdir /usr/local/share/ca-certificates/cacert.org
sudo wget -P /usr/local/share/ca-certificates/cacert.org http://www.cacert.org/certs/root.crt http://www.cacert.org/certs/class3.crt
sudo update-ca-certificates
Run Code Online (Sandbox Code Playgroud)
确保你的git确实引用了那些CA:
git config --global http.sslCAinfo /etc/ssl/certs/ca-certificates.crt
Run Code Online (Sandbox Code Playgroud)
这是时钟.NTP服务器已关闭,系统时钟设置不正确,我没有注意到或想到最初检查,错误的时间导致验证失败.
mke*_*bri 52
您还可以通过键入以下内容来禁用SSL验证(如果项目不需要除登录/密码之外的高级别安全性):
git config --global http.sslverify false
享受git :)
Waz*_*ime 26
我遇到了类似的问题并收到错误消息:
fatal: unable to access XXXX server certificate verification failed. CAfile: none CRLfile: none
Run Code Online (Sandbox Code Playgroud)
当我尝试从 WSL2 ubuntu 下的 git 连接到我的常规(正在工作!)gitlab 服务器(使用 LetsEncrypt 创建的 SSL)时,突然发生了这种情况。
从浏览器访问服务器没有问题,使用https://www.sslshopper.com/ssl-checker.html等工具检查时,SSL 链似乎正常
您需要更新您的 CA 证书。
sudo apt update
sudo apt upgrade
sudo apt-get install --reinstall ca-certificates
sudo update-ca-certificates
# now it should work perfectly
git pull
Run Code Online (Sandbox Code Playgroud)
这可能是因为这个: https:
//techcrunch.com/2021/09/21/lets-encrypt-root-expiry/
dma*_*tej 14
它也可以是自签名证书等.全局关闭SSL验证是不安全的.您可以安装证书,使其对系统可见,但证书应完全正确.
或者您可以使用一次配置参数进行克隆,因此命令将为:
git clone -c http.sslverify=false https://myserver/<user>/<project>.git;
Run Code Online (Sandbox Code Playgroud)
GIT会记住假值,你可以在<project>/.git/config文件中查看它.
AMS*_*777 14
尝试从 Linux 控制台从 Windows 子系统上的 Github 克隆存储库时,我也遇到了此错误:
致命:无法访问“http://github.com/docker/getting-started.git/”:服务器证书验证失败。CAfile:/etc/ssl/certs/ca-certificates.crt CRLfile:无
@VonC 在此线程上的解决方案对我不起作用。
这篇Fabian Lee 文章中的解决方案为我解决了这个问题:
openssl s_client -showcerts -servername github.com -connect github.com:443 </dev/null 2>/dev/null | sed -n -e '/BEGIN\ CERTIFICATE/,/END\ CERTIFICATE/ p' > github-com.pem
cat github-com.pem | sudo tee -a /etc/ssl/certs/ca-certificates.crt
Run Code Online (Sandbox Code Playgroud)
小智 6
另一个可能的原因是您机器的时钟未同步(例如在 Raspberry Pi 上)。使用以下命令检查当前日期/时间:
$ date
Run Code Online (Sandbox Code Playgroud)
如果日期和/或时间不正确,请尝试使用以下方式更新:
$ sudo ntpdate -u time.nist.gov
Run Code Online (Sandbox Code Playgroud)
或者,在虚拟机(例如 Ubuntu VirtualBox)上:
$ timedatectl set-ntp no
$ timedatectl set-time YYYY-MM-DD
$ timedatectl set-time HH:MM:SS
$ timedatectl set-ntp yes
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
83437 次 |
| 最近记录: |