文章目录
一、报错信息二、解决方案一、报错信息
参考 【错误记录】git clone 报错 ( fatal: unable to access ‘https…‘:gnutls_handshake() failed: Error in the pu ) 博客 ;
之前是通过切换网络的方式 , 解决了问题 , 这种方式随机性太大 , 继续分析该问题 ;
检查是否能 ping 通 GitHub , 执行
ping
命令 , 执行结果如下 , 丢包率 100% , 无法 ping 通 ;
二、解决方案
参考 Windows 中的解决方案 【错误记录】GitHub 网站和仓库无法访问 ( 域名重定向 | 检查 C:\Windows\System32\drivers\etc\hosts 配置文件中的 GitHub 地址域名配置 ) , 修改 Ubuntu 系统的 /etc/hosts 文件 ;
设置 GitHub 域名 :
140.82.114.4 151.101.77.194 github.global.
执行
gedit /etc/hosts
命令 , 打开 /etc/hosts 文件 , 将 GitHub 域名添加到文件中 , 完整文件内容为 :
127.0.0.1localhost127.0.1.1octopus140.82.114.4 151.101.77.194 github.global.# The following lines are desirable for IPv6 capable hosts::1ip6-localhost ip6-loopbackfe00::0 ip6-localnetff00::0 ip6-mcastprefixff02::1 ip6-allnodesff02::2 ip6-allrouters
保存并关闭 gedit 编辑器 ; ( 此处也可以使用 vim , vi 等文本编辑器 )
再次执行
ping
命令 , 最终 ping 通 GitHub :
root@octopus:~/ijkplayer# ping PING (140.82.114.4) 56(84) bytes of data.64 bytes from (140.82.114.4): icmp_seq=1 ttl=49 time=279 ms64 bytes from (140.82.114.4): icmp_seq=2 ttl=49 time=303 ms64 bytes from (140.82.114.4): icmp_seq=3 ttl=49 time=278 ms^C--- ping statistics ---3 packets transmitted, 3 received, 0% packet loss, time msrtt min/avg/max/mdev = 278.916/287.292/303.563/11.515 msroot@octopus:~/ijkplayer#