fatal: unable to access 'https://github.com/blueskylhm/gittest.git/': SSL certificate problem: unable to get local issuer certificate
这看起来是一个与 SSL 证书有关的问题。可能是因为没有正确安装 SSL 证书,或者证书已过期,导致无法访问 GitHub。您可以尝试使用以下命令来解决此问题:
git config --global http.sslVerify false
该命令将忽略 SSL 证书验证,并允许您访问 GitHub。但要注意,在使用此命令时,可能会存在一些安全风险。如果您需要进一步解决这个问题,推荐在本地计算机上更新 SSL 证书或下载最新的 Chrome 浏览器,以便使用最新的根证书验证GitHub的 SSL 证书。
win11部署dify$ git clone https://github.com/langgenius/dify.git Cloning into 'dify'... fatal: unable to access 'https://github.com/langgenius/dify.git/': SSL certificate problem: unable to get local issuer certificate
解决 Win11 上 Git Clone 出现 SSL Certificate Problem 的方案
当在 Windows 11 系统上运行 git clone
命令时,如果遇到错误提示 SSL certificate problem: unable to get local issuer certificate
[^1],这通常是因为 Git 默认不信任系统的根证书存储中的 CA 证书。以下是几种可能的解决方案:
方法一:禁用 SSL 验证
可以通过设置环境变量或配置文件来临时关闭 SSL 验证功能。
设置全局环境变量:
export GIT_SSL_NO_VERIFY=true
或者通过修改
.gitconfig
文件实现永久生效:git config --global http.sslVerify false
这种方法虽然简单有效,但由于完全绕过了 SSL 验证机制,可能会带来安全风险,因此仅建议用于测试环境[^2]。
方法二:更新 CA 证书库
Git 使用自己的 CA 证书列表而不是依赖于操作系统自带的信任链表。可以手动下载最新的 CA 证书并将其路径告知给 Git。
具体步骤如下:
下载最新版本的 cacert.pem 文件:
curl https://curl.se/ca/cacert.pem -o C:\path\to\cacert.pem
将该文件的位置告诉 Git 客户端:
git config --global http.sslCAInfo "C:\\path\\to\\cacert.pem"
此方式能够修复因过期或者缺失某些特定颁发机构而导致验证失败的情况[^3]。
方法三:切换到 HTTPS 替代协议 SSH
如果上述两种办法均不可行,则考虑改用SSH方式进行远程连接替代原有的HTTPS URL形式。首先需要生成一对新的密钥对,并上传公钥至目标服务器账户下;之后调整仓库地址即可完成迁移过程[^4]。
提供一段 Python 脚本帮助自动化处理部分流程
下面给出一个小工具样例代码片段用来自动检测当前安装好的 Git 是否已经加载了正确的 CA Bundle 并打印出来方便排查问题所在之处。
import subprocess
def check_git_ssl_cert():
try:
result = subprocess.run(['git', 'config', '--get', 'http.sslcainfo'], capture_output=True, text=True)
if result.returncode == 0 and result.stdout.strip() != "":
print(f"Current Git is using custom CA bundle located at {result.stdout}")
else:
default_path = r'C:\Program Files\Git\mingw64\ssl\certs\ca-bundle.crt'
print(f"No specific CA bundle configured for Git on this machine.\nDefault path should be:{default_path}")
except Exception as e:
print(e)
if __name__ == "__main__":
check_git_ssl_cert()
fatal: unable to access 'https://github.com/GlasierKawa/DrinkTalk.git/': SSL certificate problem: unable to get local issuer certificate
以下是解决SSL证书问题的两种方法:
- 通过配置git来解决SSL证书问题
git config --global http.sslverify false
- 通过克隆时指定SSL证书验证为false来解决
git clone https://github.com/HalfStackDeveloper/FloatBall.git -b master
相关推荐
















