pod install returns fatal error: SSL certificate i

2019-02-05 10:02发布

问题:

I just installed CocoaPods by following these instructions:

Now I opened an Xcode project which has CocoaPods in it, I opened the terminal, went into that project folder and typed "pod install" as required, and I am getting an error back:

$ pod install
Setting up CocoaPods master repo
[!] Pod::Executable clone 'https://github.com/CocoaPods/Specs.git' master

Cloning into 'master'...
fatal: unable to access 'https://github.com/CocoaPods/Specs.git/': SSL certificate problem: Invalid certificate chain

/Library/Ruby/Gems/2.0.0/gems/claide-0.4.0/lib/claide/command.rb:217:in `rescue in run': undefined method `verbose?' for nil:NilClass (NoMethodError)
    from /Library/Ruby/Gems/2.0.0/gems/claide-0.4.0/lib/claide/command.rb:210:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.29.0/lib/cocoapods/command.rb:51:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.29.0/bin/pod:24:in `<top (required)>'
    from /usr/bin/pod:23:in `load'
    from /usr/bin/pod:23:in `<main>'

I have no idea what this is about. Can someone help me? This is the first time I try to do anything with CocoaPods on OS X Mavericks.

Thanks!

回答1:

Github's SSL certificate looks fine from my end, but maybe you have distrusted it for some reason, or you are using a proxy. To resolve:

Using the Safari browser (not Chrome, Firefox or Opera) on Mac OS X 10.9 (Mavericks) visit https://github.com (no www.).

If an alert pops up, press the "Show Certificate" button, check "Always Trust", and then "Continue."

If no alert pops up, press the green or gray Security button by the URL:

Then make sure "Always trust" is checked on the certificate.

If this doesn't resolve your issue, try temporarily disabling any proxy servers you might be running, such as Charles.

After that, pod install should work.

Note: A portion of my answer text was copied from this answer.



回答2:

If you already have installed Cocoapods then write following code in terminal

sudo gem update


回答3:

Under the hood pod uses just a regular git, so disabling SSL validation for git will solve the problem:

GIT_SSL_NO_VERIFY=true pod install


回答4:

My Digicert Certificate was twice in the keychain and the used one was invalid. Deleting the expired one did the job. Thanks for point me there!



回答5:

when I run pod install, I encountered the problem : !] Pod::Executable clone 'https://github.com/CocoaPods/Specs.git' master

Cloning into 'master'... fatal: unable to access 'https://github.com/CocoaPods/Specs.git/': SSL certificate problem: Invalid certificate chain

And I finally resolved it by deleting expired certificates in keychains. When I open my terminal and run command pod install, it finally succeeded.

Hope It helps