Git SSL certificate problem: unable to get local issuer certificate

错误:

    Push failed
            Unable to access 'https://github.com/ttsin/gitTest.git/': SSL certificate problem: unable to get local issuer certificate

你在远程访问GitHub时,出现 这个错误通常表示Git无法验证GitHub的SSL证书,因为缺少本地颁发机构(CA)的根证书。

方法一:

1. 更新Git的CA证书:下载最新的CA根证书列表,并将其添加到Git的证书存储中。你可以从以下网址获取最新的Mozilla CA证书列表:https://curl.se/ca/cacert.pem

2.将该文件移动到 Git 安装目录的 "mingw64\ssl\certs" 文件夹内。

没有certs文件夹就创建,把刚才下载的证书放进文件夹中,例如: "C:\Program iles\Git\mingw64\ssl\certs"。

3.运行以下命令,将全局配置项 http.sslCAInfo 设置为新的证书路径:

git config --global http.sslCAInfo "C:\Program Files\Git\mingw64\ssl\certs\cacert.pem"

把地址换成自己电脑cacert.pem文件的地址

方法二:

2. 忽略SSL证书验证(不推荐):这是一种不建议的方法,但在某些情况下可以解决问题。你可以使用以下命令来禁用Git对SSL证书的验证:

  git config --global http.sslVerify false

   注意,这会导致Git不再验证SSL证书的真实性,可能会面临安全风险,请在仔细评估后再采用此方法。

总结:

方法一二都试过,都可以解决这个错误,方法二不安全,建议使用方法一

  • 4
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Hi there! It seems like you're facing an SSL certificate problem while using Git and getting the error "unable to get local issuer certificate." This error usually occurs when Git is unable to verify the SSL certificate of the remote repository. To fix this issue, you can try the following steps: 1. Update Git: Make sure you're using the latest version of Git. Older versions may have issues with SSL certificates. 2. Set the SSL verify flag: Run the following command to disable SSL verification temporarily: ``` git config --global http.sslVerify false ``` Note: This is not recommended for security reasons, but it can help identify if the SSL certificate is the root cause of the problem. 3. Configure Git to use the correct certificate bundle: Run the following command: ``` git config --global http.sslCAinfo /path/to/certificate.pem ``` Replace "/path/to/certificate.pem" with the path to your SSL certificate bundle. You can also try using a different certificate bundle if the current one is causing issues. 4. Update your system's certificate store: Sometimes, the SSL certificates on your system might be outdated or missing. Update your system's certificate store and try again. If none of these steps resolve the issue, it's possible that the SSL certificate is actually missing or not properly installed on the server you're trying to connect to. In such cases, you may need to contact the server administrator or use alternative methods for cloning or accessing the repository. I hope this helps! Let me know if you have any further questions.
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值