Failed to connect to GitHub to update the CocoaPods/Specs specs repo❓

1. pod update –verbose

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

https://stackoverflow.com/questions/38993527/cocoapods-failed-to-connect-to-github-to-update-the-cocoapods-specs-specs-repo

gem install cocoapods -n /usr/local/bin
ERROR: While executing gem … (Gem::FilePermissionError)
You don’t have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
 sudo chown -R $(whoami) /Library/Ruby/Gems/2.3.0

2. brew install ruby

Permission denied
Error: Can’t create update lock in /usr/local/var/homebrew/locks!
Fix permissions by running:
sudo chown -R $(whoami) /usr/local/var/homebrew
Error: The following directories are not writable by your user:
/usr/local/share/zsh
/usr/local/share/zsh/site-functions
/usr/local/var/homebrew/locks

You should change the ownership of these directories to your user.


-2019-03-27

最近一直jenkin打包和本地pod repo update一直报下面错误,正好网络那边也改了,一部分是网络问题,等网络好了,这个错误还是偶尔存在

清DNS缓存:

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder; say DNS cache flushed;

解决二(解决了):

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 /Library/Ruby/Gems/2.3.0/gems/cocoapods-core-1.7.0.beta.2/lib/cocoapods-core/github.rb:105:in rescue in modified_since_commit' /Library/Ruby/Gems/2.3.0/gems/cocoapods-core-1.7.0.beta.2/lib/cocoapods-core/github.rb:100:in modified_since_commit’

解决方法:

sudo gem update —system
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm list known
rvm install 2.6.1
gem pristine executable-hooks —version 1.6.1
gem pristine gem-wrappers —version 1.6.1

到这步再pod –version可能遇到问题,如下

Traceback (most recent call last):
2: from /usr/local/bin/pod:23:in <main>'
1: from /Users/ios/.rbenv/versions/2.6.1/lib/ruby/2.6.0/rubygems.rb:302:in
activate_bin_path’
/Users/ios/.rbenv/versions/2.6.1/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe’: can’t find gem cocoapods (>= 0.a) with executable pod (Gem::GemNotFoundException)

解决方法:

gem install cocoapods
brew upgrade ruby

上面解决以后也没经常遇到过这问题了

发表回复