Github 图片不显示问题排查

问题现象

最近一段时间,经常有同学给我们反馈,我们的 Github Readme 文件中图片显示不出来,问题现象如下:

之前其实也有遇到这类问题,但是一直没有认真排查过,这次刚好有时间,就认真看看。

排查思路

2.1. 查看报错原因

当图片无法正常加载时,从浏览器的控制台可以看到如下报错: 因为是此仓库保存的图片,检查后可以看到这个图片的源文件都是在的,但是点击诸如这样的链接:raw.githubusercontent.com/Tencent-RTC... 后,却提示:raw.githubusercontent.com 拒绝了我们的连接请求。

2.2. ping 网站地址

通过 raw.githubusercontent.com 这个地址,发现确实无法正常访问:

bash 复制代码
tatemin@TATEMIN-MC5:~ % ping raw.githubusercontent.com
PING raw.githubusercontent.com (0.0.0.0): 56 data bytes
ping: sendto: Socket is not connected
ping: sendto: Socket is not connected
Request timeout for icmp_seq 0
ping: sendto: Socket is not connected
Request timeout for icmp_seq 1
ping: sendto: Socket is not connected
Request timeout for icmp_seq 2
ping: sendto: Socket is not connected
Request timeout for icmp_seq 3

2.3. ping IP 地址

raw.githubusercontent.com 无法正常 ping 通,然后我们通过 IP 查询工具 查询到该地址对应的 IP:185.199.109.133:

然后接着 ping 这个地址:

bash 复制代码
tatemin@TATEMIN-MC5:~ % ping 185.199.110.133
PING 185.199.110.133 (185.199.110.133): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
64 bytes from 185.199.110.133: icmp_seq=4 ttl=64 time=193.524 ms
Request timeout for icmp_seq 5
Request timeout for icmp_seq 6
Request timeout for icmp_seq 7
Request timeout for icmp_seq 8
64 bytes from 185.199.110.133: icmp_seq=9 ttl=64 time=189.056 ms
Request timeout for icmp_seq 10
Request timeout for icmp_seq 11
Request timeout for icmp_seq 12
Request timeout for icmp_seq 13
64 bytes from 185.199.110.133: icmp_seq=14 ttl=64 time=192.879 ms

从输出结果显示,有部分请求超时,但也有部分请求得到了响应,说明您的网络连接存在一些问题,但并非完全无法连接,跟直接 ping 域名的结果是不一样的。

问题解决

在 Mac 上通过终端工具,修改 hosts 文件如下:

bash 复制代码
tatemin@TATEMIN-MC5:~ % cat /etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1	localhost
255.255.255.255	broadcasthost
::1             localhost
185.199.110.133 raw.githubusercontent.com // 此次新增

然后,关闭浏览器,再重新打开页面,图片资源就可以正常加载了~

相关推荐
Maya动画技术1 小时前
github-2fa认证是啥意思
github·2fa恢复码使用方法
怪侠_岭南一只猿1 小时前
爬虫阶段二实战练习题一:模拟登录github获取个人信息复盘
爬虫·github
YMWM_1 小时前
linux命令行测试是否可以访问google、github、huggingface
linux·运维·github
WangJunXiang61 小时前
系统安全及应用
安全·github·系统安全
zhensherlock1 小时前
Protocol Launcher 系列:一键唤起 VSCodium 智能 IDE
javascript·ide·vscode·typescript·开源·编辑器·github
AAA小肥杨1 小时前
OpenClaw 和 GitHub 自动化,用于 PR 审核和 CI 监控
人工智能·ci/cd·自动化·大模型·github·openclaw
白白白飘2 小时前
GitHub上运行开源项目(小白友好版)
开源·github
李同学Lino2 小时前
拒绝 500 元智商税!AutoClaw 零门槛安装教程,手把手教你低成本“喂龙虾”
人工智能·ai·github·openclaw·autoclaw
AI精钢2 小时前
OpenClaw + GitHub Copilot GPT-5.4 技术修复指南
gpt·github·copilot·github copilot·ai agent·openclaw·gpt-5.4
香水5只用六神3 小时前
【TIM】基本定时器定时实验(1)
c语言·git·stm32·单片机·嵌入式硬件·github