查看资料 GitHub 访问过慢问题的一种解决方案

[复制链接]
查看1833 | 回复12 | 2023-11-23 10:01:29 | 显示全部楼层 |阅读模式
本帖最后由 WT_0213 于 2023-11-23 10:01 编辑




                               
登录/注册后可看大图



为解决研究及学习访问 Github 过慢或其他问题,无不良引导



                               
登录/注册后可看大图


原理
此项目是通过部署此项目本身的服务器来获取 github.comhosts,而不是通过第三方ip地址接口来进行获取,例如 ipaddress.com 等。




                               
登录/注册后可看大图


最简单的方式添加hosts:
访问 https://hosts.gitcdn.top/hosts.txt , 将其全部内容粘贴到你的hosts文件中,即可。

  1. # fetch-github-hosts begin
  2. 140.82.113.25               alive.github.com
  3. 140.82.112.25               live.github.com
  4. 185.199.108.154             github.githubassets.com
  5. 140.82.114.22               central.github.com
  6. 185.199.109.133             desktop.githubusercontent.com
  7. 185.199.111.153             assets-cdn.github.com
  8. 185.199.110.133             camo.githubusercontent.com
  9. 185.199.111.133             github.map.fastly.net
  10. 151.101.41.194              github.global.ssl.fastly.net
  11. 192.30.255.113              gist.github.com
  12. 185.199.109.153             github.io
  13. 192.30.255.112              github.com
  14. 192.0.66.2                  github.blog
  15. 192.30.255.116              api.github.com
  16. 185.199.111.133             raw.githubusercontent.com
  17. 185.199.109.133             user-images.githubusercontent.com
  18. 185.199.111.133             favicons.githubusercontent.com
  19. 185.199.111.133             avatars5.githubusercontent.com
  20. 185.199.111.133             avatars4.githubusercontent.com
  21. 185.199.108.133             avatars3.githubusercontent.com
  22. 185.199.111.133             avatars2.githubusercontent.com
  23. 185.199.111.133             avatars1.githubusercontent.com
  24. 185.199.108.133             avatars0.githubusercontent.com
  25. 185.199.109.133             avatars.githubusercontent.com
  26. 192.30.255.120              codeload.github.com
  27. 3.5.11.197                  github-cloud.s3.amazonaws.com
  28. 52.216.35.185               github-com.s3.amazonaws.com
  29. 52.216.29.68                github-production-release-asset-2e65be.s3.amazonaws.com
  30. 54.231.196.73               github-production-user-asset-6210df.s3.amazonaws.com
  31. 3.5.27.169                  github-production-repository-file-5c1aeb.s3.amazonaws.com
  32. 185.199.108.153             githubstatus.com
  33. 140.82.113.18               github.community
  34. 20.99.227.183               github.dev
  35. 140.82.114.22               collector.github.com
  36. 13.107.42.16                pipelines.actions.githubusercontent.com
  37. 185.199.110.133             media.githubusercontent.com
  38. 185.199.110.133             cloud.githubusercontent.com
  39. 185.199.110.133             objects.githubusercontent.com
  40. # last fetch time: 2023-11-23 09:35:31
  41. # update url: https://hosts.gitcdn.top/hosts.txt
  42. # fetch-github-hosts end
复制代码




                               
登录/注册后可看大图


Github Hosts 同步工具


使用方法
图形化界面
ReleasesFastGit镜像 中下载您的系统版本(目前支持Windows/Linux/MacOS

下载完成解压tar.gz压缩包,运行对应平台的执行文件即可运行( ⚠ 注意:Linux下需要用sudo进行启动,WindowsMacOS会自动进行提权操作。)

客户端模式

client.png
客户端启动
client-start.png
客户端hosts源选择
client-select.png
客户端hosts源自定义
client-custom.png
服务端模式
server.png
命令行终端
到 Releases 或 FastGit镜像 中下载您的系统版本(目前支持Windows/Linux/MacOS )

参数


参数名
缩写  默认值 必填   描述
mode m  无  是  启动模式 server(服务端) / client(客户端)
interval
i
  60  否  获取记录值间隔(分钟)
port p
9898  否  服务模式监听端口以访问HTTP服务
url u  https://hosts.gitcdn.top/hosts.txt  否  客户端模式远程hosts获取链接
启动客户端:
注意:
Linux下需要使用sudo运行;
Windows和MacOS会自动进行提权操作。


直接运行
  1. # Linux/Macos
  2. sudo fetch-github-hosts -m=client
  3. # Windows
  4. fetch-github-hosts.exe -m=client
复制代码


自定义获取时间间隔
  1. # Linux/Macos(10分钟获取一次)
  2. sudo fetch-github-hosts -i=10
  3. # Windows(10分钟获取一次)
  4. fetch-github-hosts.exe -i=10
复制代码

自定义获取链接
  1. # Linux/Macos
  2. sudo fetch-github-hosts -u=http://127.0.0.1:9898/hosts.json
  3. # Windows
  4. fetch-github-hosts.exe -u=http://127.0.0.1:9898/hosts.json
复制代码

启动服务端:
直接运行
  1. # Linux/Macos
  2. fetch-github-hosts -m=server
  3. # Windows
  4. fetch-github-hosts.exe -m=server
复制代码

自定义监听端口
  1. # Linux/Macos
  2. fetch-github-hosts -m=server -p=6666
  3. # Windows
  4. fetch-github-hosts.exe -m=server -p=6666
复制代码


手动
添加hosts
访问 https://hosts.gitcdn.top/hosts.txt , 将其全部内容粘贴到你的hosts文件中,即可。

Linux / MacOS hosts路径:/etc/hosts
Windows hosts路径:C:\Windows\System32\drivers\etc\hosts
刷新生效
  1. Linux: /etc/init.d/network restart
  2. Windows: ipconfig /flushdns
  3. Macos: sudo killall -HUP mDNSResponder
复制代码


Unix/Linux 一键使用
  1. sed -i "/# fetch-github-hosts begin/Q" /etc/hosts && curl https://hosts.gitcdn.top/hosts.txt >> /etc/hosts
复制代码


提示:可以设置crontab定时任务定时获取更新即可,解放双手!


回复

使用道具 举报

qwe2079282957 | 2023-11-23 10:05:58 | 显示全部楼层
建议直接gitee拉取更省心
回复 支持 反对

使用道具 举报

WT_0213 | 2023-11-23 10:12:53 | 显示全部楼层
主要是不能每看一个项目都拉去一遍,有的可能只是看一眼。主要就是方便浏览。比打不开GitHub强一点。感觉提速效果还是挺明显的。
回复 支持 反对

使用道具 举报

lsrly | 2023-11-23 10:39:36 | 显示全部楼层
反正我们这有时能打开有时打不开
回复 支持 反对

使用道具 举报

496199544 | 2023-11-23 10:58:51 | 显示全部楼层
回复

使用道具 举报

SmileYik | 2023-11-23 12:01:20 | 显示全部楼层
现在我自己主要用的方案是反代
回复 支持 反对

使用道具 举报

aniteipc | 2023-11-23 14:08:21 | 显示全部楼层
回复

使用道具 举报

wwwday | 2023-11-23 21:46:28 | 显示全部楼层
可以用steam++加速
|Miao Miao Miao...|
                           (\__/) ||
                           (•ㅅ•) ||
                          /   づv
回复 支持 反对

使用道具 举报

iiv | 2023-11-23 22:04:57 | 显示全部楼层
很棒
回复

使用道具 举报

miiiint | 2023-11-24 00:58:55 来自手机 | 显示全部楼层
qwe2079282957 发表于 2023-11-23 10:05
建议直接gitee拉取更省心

不是每个项目都能在gitee上面找到的
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则