GitHub 访问不了?用这个方法轻松解决

新闻 前端
Github是全球最大的代码开源平台,许多程序员都会通过它寻找一些优质的开源项目,或者在上面托管自己创建的开源项目,从而提升自己。

Github是全球最大的代码开源平台,许多程序员都会通过它寻找一些优质的开源项目,或者在上面托管自己创建的开源项目,从而提升自己。

不知道大家最近有没有出现这种情况,Github总是突然无法访问,解析出来的几个IP都是不定时出现tcp connect time out,而且就算连接成功了,下次在连接,相同的IP也很容易连接失败,据某位知乎大佬给出的猜测是旁路识别出SSL证书后,开始阻止新的链接,若干秒后才会解除。

还好,猿妹在Github上找到一个开源项目,就是帮助大家解决这个问题的,使用方法十分简单,小白也能操作。

这个项目无需安装任何程序,通过修改本地 hosts 文件,试图解决:

  • GitHub 访问速度慢的问题
  • GitHub 项目中的图片显示不出的问题

使用方法

首先,你需要复制以下内容:

  1. # GitHub520 Host Start 
  2.  
  3. 185.199.108.154 github.githubassets.com 
  4.  
  5. 140.82.114.21 central.github.com 
  6.  
  7. 185.199.108.133 desktop.githubusercontent.com 
  8.  
  9. 185.199.108.153 assets-cdn.github.com 
  10.  
  11. 185.199.108.133 camo.githubusercontent.com 
  12.  
  13. 185.199.108.133 github.map.fastly.net 
  14.  
  15. 199.232.69.194 github.global.ssl.fastly.net 
  16.  
  17. 140.82.113.4 gist.github.com 
  18.  
  19. 185.199.108.153 github.io 
  20.  
  21. 140.82.114.3 github.com 
  22.  
  23. 140.82.113.5 api.github.com 
  24.  
  25. 185.199.108.133 raw.githubusercontent.com 
  26.  
  27. 185.199.108.133 user-images.githubusercontent.com 
  28.  
  29. 185.199.108.133 favicons.githubusercontent.com 
  30.  
  31. 185.199.108.133 avatars5.githubusercontent.com 
  32.  
  33. 185.199.108.133 avatars4.githubusercontent.com 
  34.  
  35. 185.199.108.133 avatars3.githubusercontent.com 
  36.  
  37. 185.199.108.133 avatars2.githubusercontent.com 
  38.  
  39. 185.199.108.133 avatars1.githubusercontent.com 
  40.  
  41. 185.199.108.133 avatars0.githubusercontent.com 
  42.  
  43. 185.199.108.133 avatars.githubusercontent.com 
  44.  
  45. 140.82.113.10 codeload.github.com 
  46.  
  47. 52.216.226.40 github-cloud.s3.amazonaws.com 
  48.  
  49. 52.216.162.99 github-com.s3.amazonaws.com 
  50.  
  51. 52.216.142.196 github-production-release-asset-2e65be.s3.amazonaws.com 
  52.  
  53. 52.217.97.236 github-production-user-asset-6210df.s3.amazonaws.com 
  54.  
  55. 52.217.194.41 github-production-repository-file-5c1aeb.s3.amazonaws.com 
  56.  
  57. 185.199.108.153 githubstatus.com 
  58.  
  59. 64.71.168.201 github.community 
  60.  
  61. 185.199.108.133 media.githubusercontent.com 
  62.  
  63.  
  64.  
  65. # Update time: 2021-03-24T16:06:33+08:00 
  66.  
  67. # Star me GitHub url: https://github.com/521xueweihan/GitHub520 
  68.  
  69. # GitHub520 Host End 

接着,你需要去修改 hosts 文件,hosts 文件在每个系统的位置不一,详情如下:

  • Windows 系统:C:\Windows\System32\drivers\etc\hosts
  • Linux 系统:/etc/hosts
  • Mac(苹果电脑)系统:/etc/hosts
  • Android(安卓)系统:/system/etc/hosts
  • iPhone(iOS)系统:/etc/hosts

修改方法,把第一步的内容复制到文本末尾:

  • Windows 使用记事本。
  • Linux、Mac 使用 Root 权限:sudo vi /etc/hosts。
  • iPhone、iPad 须越狱、Android 必须要 root。

大部分情况下是直接生效,如未生效可尝试下面的办法,刷新 DNS:

  • Windows:在 CMD 窗口输入:ipconfig /flushdns
  • Linux 命令:sudo rcnscd restart
  • Mac 命令:sudo killall -HUP mDNSResponder

是不是觉得超级简单?目前,GitHub520已经在Github上标星 4.1K,累计分支 348 个(Github地址:https://github.com/521xueweihan/GitHub520)

如果你的Github在访问时也出现图裂、或者加载缓慢等问题,不妨试试。Github520,让你重新爱上Github。

 

责任编辑:张燕妮 来源: 开源最前线
相关推荐

2013-01-22 11:15:40

GitHub

2018-10-11 14:21:10

苹果手机

2020-07-17 11:30:39

密钥Github数据安全

2010-05-26 18:52:12

SVN库

2010-01-07 16:46:06

Linux安装Ecli

2022-05-11 09:16:55

Linux网络

2021-05-12 11:08:33

PPT代码工具

2023-03-19 17:29:01

2021-07-13 10:17:25

GitHubLinux代码

2021-08-31 09:41:57

LinuxiPhone开源工具

2021-09-01 09:47:25

Linux 工具 开发

2020-11-27 15:57:28

Github应用速度

2021-07-07 09:24:40

Logo图形设计加法

2023-08-07 09:08:25

软件微信钉钉

2011-05-04 14:18:22

针式打印机

2021-09-12 06:02:49

网盘FileSplit F软件

2011-09-08 16:47:05

windows7注册表

2022-05-31 09:01:13

GitHub工具安全

2022-03-08 23:04:28

Windows系统数据

2011-03-11 10:39:07

LAMPPHP
点赞
收藏

51CTO技术栈公众号