github无法访问问题解决

2021-03-05 14:59:19  卢浮宫  版权声明:本文为站长原创文章,转载请写明出处


一、背景


    最近在登录github和拉取及提交代码时经常失败。

    常见错误如下:

        Push failed: Unable to access 'https://github.com/BXXXger.git/': Failed to connect to github.com port 443: Timed out

        Push failed: Unable to access 'https://github.com/BXXXer.git/': OpenSSL SSL_read: Connection was reset, errno 10054

        Push failed: Unable to access 'https://github.com/BXXXger.git/': 

            SSL: no alternative certificate subject name matches target host name 'github.com'


二、问题


    ① 有时是因为域名DNS解析问题

    ② 网络不通畅

    ③ 被墙了


三、解决方案

    

    3.1、找寻到github的ip地址

        使用 win + R 调出命令控制台输入 ping github.com

        
    

    3.2、优化DNS

        在浏览器中打开如下链接:http://tool.chinaz.com/dns?type=1&host=github.com&ip=
        然后选取TTL值最小的那个的IP
        

    

    3.3、修改电脑hosts文件内容

        ① 在电脑中找到如下路径:C:\Windows\System32\drivers\etc

        ② 里面有一个hosts文件,使用文本编辑器打开

        ③ 然后在最下面加上如下信息(以你上述操作中获取的ip为准):

            52.74.233.119 github.com

            199.232.69.194 github.com

        


    3.4、刷新网络配置信息

        ① 同样使用 win + r 打开命令控制台

        ② 输入: ipconfig /flushdns

        


五、后记

    通过上述操作,一般来说多数问题能够得到缓解或解决。

    站长经过测试后确实解决了我当下的问题,希望也能对你有所帮助!


更多精彩,请持续关注:guangmuhua.com


最新评论:

这个表情还是可以的
2021-03-08 15:47:34
1楼
你好啊,
emoji测试
再来个qq的
2021-03-08 15:18:50
2楼