9

我正在尝试在 Github 上克隆一个存储库,但我遇到了 SSL 证书问题。

$ git clone  https://github.com/HonzaKral/django-threadedcomments.git  
Initialized empty Git repository in /Users/Bryan/work/django-threadedcomments/.git/
error: SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed while accessing    https://github.com/HonzaKral/django-threadedcomments.git/info/refs

fatal: HTTP request failed

如何安装适当的证书?

编辑:我能够通过使用 git:// 与 https:// 完全避免这个问题

4

1 回答 1

14

打开Keychain Access,选择“System Roots”中的所有证书(除了那些被划掉的,如果有的话),右键单击并将所有项目导出到 PEM 文件中。

然后,使用git config --system http.sslCAInfo /path/to/this/file.pem. 如果您不想--system在克隆该特定存储库之前全局设置此路径,则可以在GIT_SSL_CAINFO环境变量中设置此路径(例如GIT_SSL_CAINFO=/path/to/this/file.pem git clone ...)。这将使 Git(和 libcurl)将该文件用作受信任的 CA 文件。(您可以在git-config 手册页中查看此选项的详细信息。)

于 2012-02-13T17:00:55.237 回答