Search code examples
gitsslgithubcocoapodsmacos-sierra

SSL verification problems trying to clone git repo with cocoapods


I've just created a new Xcode 8 project and I'm trying to install Alamofire via CocoaPods. Just after pod install I'm getting this error:

[!] 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)`

Last Friday I've installed another library into another Xcode 8 project with no problems at all, so I really don't know what to do. In both cases I've used a Macbook Pro with MacOs Sierra.


Solution

  • You have a similar ticket in CocoaPods-app issue 355.

    If it was working before and not now, something must be different between the two pod install instances. Either the user is not the same, or the url involved is different (ssh before vs. https now for instance)

    As suggested here or in this issue, check your global git config (~/.gitconfig) and remove slCAInfo and sslVerify settings to see if the issue persists.
    Or check if you have an environment variable SSL_CERT_FILE currently active (exported). (also mentioned in this issue)

    Try and see if using ssh works better:

    git config --global url."[email protected]/Alamofire".insteadOf https://github.com/Alamofire
    

    As the OP Aleph72 commented below:

    My slCAInfo line in the git config was pointing to an exported .pem file that included two certificates, and one of those expired few days ago.

    So removing that sslCAinfo setting would help here.