尝试使用cocoapods克隆git repo的SSL验证问题

时间:2016-09-26 09:22:37

标签: git ssl github cocoapods macos-sierra

我刚刚创建了一个新的Xcode 8项目,我正在尝试通过CocoaPods安装Alamofire。 就在pod install之后我收到了这个错误:

[!] Error installing Alamofire
[!] /usr/bin/git clone https://github.com/Alamofire/Alamofire.git /var/folders/18/n59jh6715l38t9wsmbgv5yvc0000gp/T/d20160926-3719-16da22u --template= --single-branch --depth 1 --branch 4.0.1

Cloning into '/var/folders/18/n59jh6715l38t9wsmbgv5yvc0000gp/T/d20160926-3719-16da22u'...
fatal: unable to access 'https://github.com/Alamofire/Alamofire.git/': SSL: certificate verification failed (result: 5)`

上周五我已经将另一个库安装到另一个Xcode 8项目中,没有任何问题,所以我真的不知道该怎么做。 在这两种情况下,我都使用Macbook Pro和MacOs Sierra。

1 个答案:

答案 0 :(得分:2)

您在CocoaPods-app issue 355中有类似的票证。

如果之前有效,而不是现在,则两个pod安装实例之间必须有所不同。用户不一样,或者涉及的网址不同(例如,现在与之前的https相比)

suggested herein this issue,请检查您的全局git配置(~/.gitconfig)并移除slCAInfosslVerify设置以查看问题是否仍然存在。<登记/> 或者检查一下have an environment variable SSL_CERT_FILE currently active (exported)。 (也提到in this issue

尝试看看是否更好地使用ssh:

git config --global url."git@github.com/Alamofire".insteadOf https://github.com/Alamofire

OP Aleph72评论below

  

我在git config中的slCAInfo行指向一个导出的.pem文件,其中包含两个证书,其中一个证书在几天前过期。

因此删除sslCAinfo设置会有所帮助。