Github上的图片不显示这个问题困扰我好久了,之前一直觉得用不太到,也就没解决,今天在写通过Rancher安装k8s这篇博客时才发现不得不解决这个问题了。

      通过谷歌,博主john-zeng这样解释道:

实际上,可以认为,ERR_CERT_COMMON_NAME_INVALID就是用一个错误的域名访问了某个节点的https资源。导致这个错误的原因,基本是:  
dns污染
host设置错误
官方更新了dns,但是dns缓存没有被更新,导致错误解析。

      也就是说我们需要本地hosts文件对网站进行域名解析,Windows系统hosts文件位置:C:\Windows\System32\drivers\etc\hosts,在hosts文件中添加

# GitHub Start 
140.82.113.3      github.com
140.82.114.20     gist.github.com
151.101.184.133    assets-cdn.github.com
151.101.184.133    raw.githubusercontent.com
151.101.184.133    gist.githubusercontent.com
151.101.184.133    cloud.githubusercontent.com
151.101.184.133    camo.githubusercontent.com
151.101.184.133    avatars0.githubusercontent.com
199.232.68.133     avatars0.githubusercontent.com
199.232.28.133     avatars1.githubusercontent.com
151.101.184.133    avatars1.githubusercontent.com
151.101.184.133    avatars2.githubusercontent.com
199.232.28.133     avatars2.githubusercontent.com
151.101.184.133    avatars3.githubusercontent.com
199.232.68.133     avatars3.githubusercontent.com
151.101.184.133    avatars4.githubusercontent.com
199.232.68.133     avatars4.githubusercontent.com
151.101.184.133    avatars5.githubusercontent.com
199.232.68.133     avatars5.githubusercontent.com
151.101.184.133    avatars6.githubusercontent.com
199.232.68.133     avatars6.githubusercontent.com
151.101.184.133    avatars7.githubusercontent.com
199.232.68.133     avatars7.githubusercontent.com
151.101.184.133    avatars8.githubusercontent.com
199.232.68.133     avatars8.githubusercontent.com
# GitHub End

      修改完hosts文件后再刷新下DNS缓存就大功告成啦,刷新DNS缓存命令为ipconfig /flushdns,这里的命令需要在CMD中运行,做到这里就可以恭喜你可以继续在GitHub上愉快的玩耍了:)。


一个好奇的人