Mac系統(tǒng)下GitHub圖片不顯示解決方案(Windows可用)

其他網(wǎng)站圖片不顯示,可參考以下步驟自行嘗試解決。

在GitHub圖片不顯示網(wǎng)頁下按fn+F12,可看到報錯
主要報錯是Failed to load resource: net::ERR_CERT_COMMON_NAME_INVALID
去查了一下,博主john-zeng這樣解釋道:
實際上,可以認為,ERR_CERT_COMMON_NAME_INVALID就是用一個錯誤的域名訪問了某個節(jié)點的https資源。導(dǎo)致這個錯誤的原因,基本是:
1、dns污染
2、host設(shè)置錯誤
3、官方更新了dns,但是dns緩存沒有被更新,導(dǎo)致錯誤解析。


本人用的Mac系統(tǒng),操作如下:(Win請可先看4和5)
1、打開終端輸入sudo vi /etc/hosts,輸入電腦密碼

2、修改hosts文件,按i開始輸入,可以直接選中以下內(nèi)容復(fù)制粘貼,20200328更新

# 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

3、如下圖,輸入完畢按esc鍵,輸入:wq退出即可

hosts文件

4、windows打開C:\Windows\System32\drivers\etc\hosts文件,拷貝一份出來,粘貼以上內(nèi)容即可顯示圖片。

5、其他解決方案:對本地DNS緩存進行一次刷新

  • Mac刷新DNS:
sudo killall -HUP mDNSResponder

復(fù)制完了按鍵盤return鍵,接著輸入管理員密碼,稍微等待一下就會刷新的DNS。其他版本的刷新命令如下:
Mac OS X 10.7 – 10.8:sudo killall -HUP mDNSResponder
Mac OS X 10.5 – 10.6:dscacheutil -flushcache
Mac OS X 10.4:lookupd -flushcache
如果以上命令無效,請自行查找。

  • Windows刷新DNS:
    在打開的cmd命令行窗口中,輸入ipconfig /flushdns命令,點擊Enter,這樣就可以刷新本地的DNS緩存數(shù)據(jù)。

獲取域名的IP地址網(wǎng)站:https://www.ipaddress.com/
如有其他需要請參考原文鏈接:https://blog.csdn.net/qq_38232598/article/details/91346392


最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容