方法一:把pod源更換成國內鏡像源
// 移除現有的鏡像
pod repo remove master
// 添加新鏡像源
pod repo add master https://gitcafe.com/akuandev/Specs.git
pod repo update
pod setup
國內源有
https://gitcafe.com/akuandev/Specs.git
http://git.oschina.net/akuandev/Specs.git
https://git.coding.net/hging/Specs.git
https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git
方法二:增加git緩存大小
git config --global http.postBuffer
方法三:映射github.com的IP地址
https://github.com.ipaddress.com/
查找出Github.com最新的IP地址為:140.82.114.4
打開終端,運行:
sudo vim /private/etc/hosts
編輯進去:
173.194.201.91 dl-ssl.google.com
64.233.177.101 groups.google.com
199.232.69.194 github.global.ssl.fastly.net
172.217.0.10 ajax.googleapis.com
保存退出,重新打開終端,再次輸入 “ping github.com”, 即可ping 通。之后下載就不會出現卡住問題