返回

Git拉取仓库时证书错误处理技巧

处理在使用Git克隆仓库时遇到的SSL证书错误的方法。
2021-12-03
git
471 字 · 约 2 分钟阅读

git拉取仓库时提示证书错误

 git clone https://domain.com/chancel/gmcc.git
Cloning into 'gmcc'...
fatal: unable to access 'https://domain.com/chancel/gmcc.git/': Problem with the SSL CA cert (path? access rights?)

这种是由于https证书私签导致的,我们需要忽略证书错误才能正常拉取

 env GIT_SSL_NO_VERIFY=true git clone https://domain.com/chancel/gmcc.git

为了避免每次拉取此项目代码都需要忽略证书错误,进入仓库目录直接设置仓库忽略证书错误

 cd gmcc
➜ git config http.sslVerify false

当然也可以设置全局忽略git证书错误的问题(有一定安全风险)

 git config --global http.sslVerify false

留言

发表留言