Cocoapods: Failed to connect to GitHub to update t

2019-01-08 03:23发布

When running pod repo update the following error is generated:

Updating spec repo `master`
[!] Failed to connect to GitHub to update the CocoaPods/Specs specs repo - Please check if you are offline, or that GitHub is down


Using cocoapods 1.0.1

I'm also aware of this: Master spec-repo rate limiting post‑mortem.


Adding --verbose flag to the call shows the ruby call stack:

.rvm/gems/ruby-2.3.0/gems/cocoapods-core-1.0.1/lib/cocoapods-core/github.rb:100:in `modified_since_commit'
.rvm/gems/ruby-2.3.0/gems/cocoapods-core-1.0.1/lib/cocoapods-core/master_source.rb:32:in `requires_update?'
.rvm/gems/ruby-2.3.0/gems/cocoapods-core-1.0.1/lib/cocoapods-core/master_source.rb:14:in `update'
.rvm/gems/ruby-2.3.0/gems/cocoapods-1.0.1/lib/cocoapods/sources_manager.rb:88:in `block (2 levels) in update'
.rvm/gems/ruby-2.3.0/gems/cocoapods-1.0.1/lib/cocoapods/user_interface.rb:63:in `section'
.rvm/gems/ruby-2.3.0/gems/cocoapods-1.0.1/lib/cocoapods/sources_manager.rb:87:in `block in update'
.rvm/gems/ruby-2.3.0/gems/cocoapods-1.0.1/lib/cocoapods/sources_manager.rb:86:in `each'
.rvm/gems/ruby-2.3.0/gems/cocoapods-1.0.1/lib/cocoapods/sources_manager.rb:86:in `update'
.rvm/gems/ruby-2.3.0/gems/cocoapods-1.0.1/lib/cocoapods/command/repo/update.rb:23:in `run'
.rvm/gems/ruby-2.3.0/gems/claide-1.0.0/lib/claide/command.rb:334:in `run'
.rvm/gems/ruby-2.3.0/gems/cocoapods-1.0.1/lib/cocoapods/command.rb:50:in `run'
.rvm/gems/ruby-2.3.0/gems/cocoapods-1.0.1/bin/pod:55:in `<top (required)>'
.rvm/gems/ruby-2.3.0/bin/pod:23:in `load'
.rvm/gems/ruby-2.3.0/bin/pod:23:in `<main>'
.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'


Can't find any way to workaround this and cannot run the project.

15条回答
迷人小祖宗
2楼-- · 2019-01-08 03:30

I did next in Terminal:

  1. brew install openssl

    if you don't have home brew:

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

    and repeat p.1

  2. export PATH="/usr/local/opt/openssl/bin:$PATH"

  3. openssl version

    Output:OpenSSL 1.0.2n 7 Dec 2017

  4. pod update

查看更多
Evening l夕情丶
3楼-- · 2019-01-08 03:33

Anyone facing any similar issue where the remote hangs-up prematurely, use ssh to clone the repo instead.

git clone git@github.com:CocoaPods/Specs.git master.

In order to use SSH to clone a GitHub repo, you need to have a GitHub account and have your SSH keys associated with it.

Follow their documentation here.

查看更多
甜甜的少女心
4楼-- · 2019-01-08 03:34

Finally managed to solve it by deleting ./cocoapods/repos/master and running pod install.

The more formal solution would probably go like this:

pod repo remove master
pod setup
pod install

If pod install fails after performing the first two steps, you may need to delete your Podfile.lock.

Why it initially failed to connect to Github is beyond me.

查看更多
一夜七次
5楼-- · 2019-01-08 03:35

Just update cocoapods: sudo gem install cocoapods

查看更多
干净又极端
6楼-- · 2019-01-08 03:38

This worked like magic

$sudo rm -fr ~/.cocoapods/repos/master
$pod setup
$pod install

Otherwise

$pod setup
Ctrl +C
cd ~/.cocoapods/repos 
$git clone --depth 1 https://github.com/CocoaPods/Specs.git master
查看更多
男人必须洒脱
7楼-- · 2019-01-08 03:43

I also encountered the same issue. In my scene, i used a mirror repo (hosted elsewhere) of cocoapods specs on github. When i updated the specs repo, it worked!

cd ~/.cocoapods/repos/master
git pull
查看更多
登录 后发表回答