iOS开发之访问GitHub慢

作者: chasitu | 来源:发表于2021-10-25 18:30 被阅读0次

    我们一般过一段时间之后访问GitHub会变慢,究其原因其实就是我们的host文件需要更新一下

    今天使用cocoapods安装的时候报错了,我们今天解决这个问题的同时也查看一下原因

    [!] Error installing ReactiveCocoa
    [!] /usr/bin/git clone https://github.com/ReactiveCocoa/ReactiveCocoa.git /var/folders/np/3ty5h5jd439ft50q9s0ygnfh0000gn/T/d20200421-5534-yfmqbf --template= --single-branch --depth 1 --branch 7.2.0
    
    Cloning into '/var/folders/np/3ty5h5jd439ft50q9s0ygnfh0000gn/T/d20200421-5534-yfmqbf'...
    fatal: unable to access 'https://github.com/ReactiveCocoa/ReactiveCocoa.git/': Failed to connect to github.com port 443: Operation timed out
    
    

    看到这里, 我上来就 ping github.com 了一下 发现直接就 timeout了,淡淡的忧伤。

    使用DNS工具查找github.com等域名TTL较小的 IP
    1. 打开链接 http://ping.chinaz.com 输入 github.com ,点击Ping检测
    2. 选择一条TTL值最小的ip地址,例如:192.30.255.113
      修改hosts<下面的路径>
      sudo vim /private/etc/hosts
      追加一行:192.30.253.113 github.com

    ok

    相关文章

      网友评论

        本文标题:iOS开发之访问GitHub慢

        本文链接:https://www.haomeiwen.com/subject/xsksaltx.html