解决GitHub中头像显示异常、设置不了头像、README图片无法显示等问题

  很多时候在访问 GitHub 官网时容易出现 GitHub 头像显示异常的问题。虽然这个问题无关痛痒,不过对于有强迫症的人来说非解决不可。也有时候居然在设置中编辑不了头像(编辑头像的窗体一直加载不出。笔者曾经尝试让电脑加载一晚上,但是第二天醒来,发现编辑头像的窗体还在显示正在加载的转圈动画,真是不能忍了)。解决的办法也很简单。

  头像显示异常、设置不了头像、README.md 中的图片显示裂图等问题是解析外国网站域名超时所导致的。我们可以通过进行域名重定向来解决。域名重定向可以跳过对域名的解析而直接访问其IP,这样能尽量避免超时。

  域名重定向在文件 hosts(文件 hosts 位于 C:\Windows\System32\drivers\etc)里配置来实现。以文本方式打开文件 hosts(注意:文件 hosts 是一个没有文件后缀的文件,不是文件 hosts.txt),在其添加以下内容:

# GitHub 开始 此右侧域名的IP    github.com
此右侧域名的IP    gist.github.com
此右侧域名的IP    assets-cdn.github.com
此右侧域名的IP    raw.githubusercontent.com
此右侧域名的IP    gist.githubusercontent.com
此右侧域名的IP    cloud.githubusercontent.com
此右侧域名的IP    camo.githubusercontent.com
此右侧域名的IP    avatars.githubusercontent.com
此右侧域名的IP    avatars0.githubusercontent.com
此右侧域名的IP    avatars1.githubusercontent.com
此右侧域名的IP    avatars2.githubusercontent.com
此右侧域名的IP    avatars3.githubusercontent.com
此右侧域名的IP    avatars4.githubusercontent.com
此右侧域名的IP    avatars5.githubusercontent.com
此右侧域名的IP    avatars6.githubusercontent.com
此右侧域名的IP    avatars7.githubusercontent.com
此右侧域名的IP    avatars8.githubusercontent.com
此右侧域名的IP    media.githubusercontent.com# GitHub 结束

  其中,“此右侧域名的 IP”部分需要你自己将右侧域名的正确 IP 换上。而域名可以通过在页面代码(页面代码可以在浏览器中的“开发人员工具”中查看)中获取(光标在页面代码中移动可以定位图片的域名)。那么,如何知道右侧域名的正确 IP 呢?可以通过IP查询网站: https://www.ipaddress.com/ 。使用此网站解析域名后,将 IP 替换到上述文本的相应的内容即可。另外要注意,域名的 IP 有可能以后会变化,因此要及时更新 hosts 文件的内容,否则以后某天 GitHub 官网会打不开。

  最后在 CMD 中输入此命令 ipconfig /flushdns 来刷新 DNS 缓存,从而使上述文件 hosts 中的配置生效。


【附】一些关于 ipconfig 的命令:

  • 刷新 DNS 缓存:ipconfig /flushdns

  • 显示 DNS 缓存:ipconfig /flushdns

  • 使用 DHCP 协议更新 IP:ipconfig /renew


  截止到 2021 年 3 月 10 日,上述的域名解析结果为:

# GitHub 开始 140.82.113.4      github.com
140.82.114.3      gist.github.com
185.199.108.153   assets-cdn.github.com
185.199.108.133    raw.githubusercontent.com
185.199.108.133    gist.githubusercontent.com
185.199.108.133    cloud.githubusercontent.com
185.199.108.133    camo.githubusercontent.com
185.199.108.133    avatars.githubusercontent.com
185.199.108.133    avatars0.githubusercontent.com
185.199.108.133    avatars1.githubusercontent.com
185.199.108.133    avatars2.githubusercontent.com
185.199.108.133    avatars3.githubusercontent.com
185.199.108.133    avatars4.githubusercontent.com
185.199.108.133    avatars5.githubusercontent.com
185.199.108.133    avatars6.githubusercontent.com
185.199.108.133    avatars7.githubusercontent.com
185.199.108.133    avatars8.githubusercontent.com
185.199.108.133    media.githubusercontent.com# GitHub 结束

  另外,使用 IP 查询网站 https://www.ipaddress.com/ 查询上述 IP 的快捷查询网址为:

待查询网址 快捷查询网址
github.com https://github.com.ipaddress.com/
gist.github.com https://github.com.ipaddress.com/gist.github.com
assets-cdn.github.com https://github.com.ipaddress.com/assets-cdn.github.com
raw.githubusercontent.com https://githubusercontent.com.ipaddress.com/raw.githubusercontent.com
gist.githubusercontent.com https://githubusercontent.com.ipaddress.com/gist.githubusercontent.com
cloud.githubusercontent.com https://githubusercontent.com.ipaddress.com/cloud.githubusercontent.com
camo.githubusercontent.com https://githubusercontent.com.ipaddress.com/camo.githubusercontent.com
avatars.githubusercontent.com https://githubusercontent.com.ipaddress.com/avatars.githubusercontent.com
avatars0.githubusercontent.com https://githubusercontent.com.ipaddress.com/avatars0.githubusercontent.com
avatars1.githubusercontent.com https://githubusercontent.com.ipaddress.com/avatars1.githubusercontent.com
avatars2.githubusercontent.com https://githubusercontent.com.ipaddress.com/avatars2.githubusercontent.com
avatars3.githubusercontent.com https://githubusercontent.com.ipaddress.com/avatars3.githubusercontent.com
avatars4.githubusercontent.com https://githubusercontent.com.ipaddress.com/avatars4.githubusercontent.com
avatars5.githubusercontent.com https://githubusercontent.com.ipaddress.com/avatars5.githubusercontent.com
avatars6.githubusercontent.com https://githubusercontent.com.ipaddress.com/avatars6.githubusercontent.com
avatars7.githubusercontent.com https://githubusercontent.com.ipaddress.com/avatars7.githubusercontent.com
avatars8.githubusercontent.com https://githubusercontent.com.ipaddress.com/avatars8.githubusercontent.com
media.githubusercontent.com https://githubusercontent.com.ipaddress.com/media.githubusercontent.com

解决GitHub中头像显示异常、设置不了头像、README图片无法显示等问题相关推荐

  1. 解决php中json_decode的异常JSON_ERROR_CTRL_CHAR

    解决php中json_decode的异常JSON_ERROR_CTRL_CHAR 参考文章: (1)解决php中json_decode的异常JSON_ERROR_CTRL_CHAR (2)https: ...

  2. 如何在html上显示时间设置,js实现在网页上简单显示时间的方法

    本文实例讲述了js实现在网页上简单显示时间的方法.分享给大家供大家参考.具体如下: 这是一款网页时钟JS代码,纯javascript实现,显示时.分.秒.网页时间显示.网页时钟有很多,这个真的挺简易的 ...

  3. 如何解决WPS中文章段落格式设置失效

    办公族们经常需要对文档进行排版,段落格式的设置不可避免.但有的时候,设置了格式,却没有完全生效,究竟是怎么一回事呢?下面,听我慢慢解释. 操作步骤 1 选中某一段落,右键,选择段落进行格式设置,将段前 ...

  4. 解决GitHub中灰色文件夹问题

    有时候发现git push后在github上文件夹是灰色的 网上说:是因为子文件夹下还有git仓库,删掉就好了. 但是,貌似没有成功. 于是我就摸索出了以下方法: 1.在本地库中,删掉所有灰色文件夹, ...

  5. 教程:github中404网站的设置

    教程 首先先在public文件夹内新建一个404.md文档 (如果你会配置html也可以直接新建404.html) 在md文档开头输入 --- permalink: /404.html --- 来表示 ...

  6. 解决MySQL中主键无法设置自增

    问题:为什么主键无法设置自增? 修改前:可以看到我给主键设置的类型为字符串 而自增的前提为int数据类型,因此导致AI自增无法点击. 修改前: 解决方法:将主键的datatype修改为int 自增就能 ...

  7. 解决toad中number类型小数位数过长按科学计数法显示的问题

    在toad中->view->option->data->display large number in scientific notation,不选择该选项即可. (在pl/s ...

  8. fckeditor php 不显示,PHP Fckeditor上传文件(或图片)中文显示为乱码的解决方法

    中文名乱码是因为: FCKeditor使用UTF-8编码, 自己机子比如是Windows系统 文件名使用的是GBK编码, 在上传中需要,改下编码,从UTF-8到GBK ==>第一个思路,转码思路 ...

  9. 目标检测--将xml文件中标签(矩形框)在其原图片上显示并另存

    """ 目的:将原图片(img)与其xml(xml),合成为打标记的图片(labelled),矩形框标记用红色即可 已有:(1)原图片文件夹(imgs_path),(2) ...

最新文章

  1. python 定时任务
  2. UIView上的控件使用push方法跳转
  3. 格式说明_现代诗歌的写作格式是什么,能否举例说明?
  4. sympy随笔-python符号计算
  5. 多轮对话之对话管理:Dialog Management
  6. 设计模式(5)--工厂模式
  7. 斯坦福大学教育学院院长:学习本身就是一门学问
  8. 改善代码设计 —— 优化物件之间的特性(Moving Features Between Objects)
  9. 设置手机项目首选参数
  10. npm下载缓慢解决方法
  11. java网页统计访客量_Java中的访客设计模式
  12. [转]让内网MOSS门户也用域名访问
  13. office 2010 系列问题
  14. ASP.NET快速入门
  15. ipa在线安装搭建_iphone直接安装ipa文件怎么做?
  16. 跨语言rpc框架Thrift
  17. ubuntu使用 ffmpeg 转换amr格式为mp3
  18. virt-install 使用说明
  19. 如何高效的配置Nginx
  20. Form--Form表单

热门文章

  1. 容器资源需求、资源限制(二十二)
  2. WiFi攻击中的“核武器”长啥样?来,今天咱们开开眼...
  3. 每周一书《Spark与Hadoop大数据分析》分享!
  4. 百度黄埔学院学员开题 | ‘首席 AI 架构师’实战之旅开启!
  5. linux命令:until循环
  6. Linux环境下Android开发环境的搭建
  7. 详解iBaits中SqlMapClientTemplate的使用
  8. Linux01-Linux文本编辑器vim编辑器深入详解22
  9. 浏览器还 data URI协议
  10. dns服务器漏洞修复,KB4569509:DNS 服务器漏洞 CVE-2020-1350 指南