今天要pod一個新庫漏益,打開終端 pod update時報如下錯誤:
Cocoapods: Failed to connect to GitHub to update the CocoaPods/Specs specs repo
匯總找到的解決方案如下:
1.更新openssl
/usr/bin/ruby -e"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
在終端輸入上述命令之后又報下面的錯誤:
curl: (7) Failed to connect to raw.githubusercontent.com port 443 after 7 ms: Connection refused
這時候就需要檢查hosts文件里的ip了
2.檢查hosts文件
打開hosts文件:?(command) + G /private/etc/hosts
一個個ping里面的ip地址吼鳞,看能否ping通币绩,不能ping通的就刪掉拉宗。
終端輸入:
sudo vim /etc/hosts
按提示輸入密碼
按 i 鍵進入編輯模式
光標(biāo)移動刪除
3.png
刪除之后ESC退出編輯模式咖祭, 輸入 :wq 保存(輸入冒號wq)锻弓。
3.新增ip地址
打開網(wǎng)址:
https://www.ipaddress.com
查詢raw.githubusercontent.com 的真實IP
image
將這幾個ip地址復(fù)制到一個空白文檔下砾赔。
在每個ip地址后面 粘貼上 raw.githubusercontent.com
再重復(fù)方法2的流程編輯 host文件,將上述ip地址粘貼上去
image
這樣就可以了青灼,再試試 pod update 可以正常使用了暴心。