首页
/ 【亲测免费】 GitHub Hosts 项目使用教程

【亲测免费】 GitHub Hosts 项目使用教程

2026-01-16 10:01:33作者:冯梦姬Eddie

1. 项目的目录结构及介绍

GitHub Hosts 项目的目录结构如下:

github-hosts/
├── LICENSE
├── README.md
├── hosts
├── next-hosts
└── src/
    ├── main/
    │   └── java/
    │       └── com/
    │           └── maxiaofa/
    │               └── hosts/
    └── test/
        └── java/
            └── com/
                └── maxiaofa/
                    └── hosts/

目录结构介绍

  • LICENSE: 项目的许可证文件。
  • README.md: 项目说明文档。
  • hosts: 主要的 hosts 文件,用于加速 GitHub 访问。
  • next-hosts: 基于 DNS 的新方案 hosts 文件。
  • src/: 项目的源代码目录。
    • main/: 主代码目录。
      • java/: Java 源代码目录。
        • com/maxiaofa/hosts/: 具体实现代码。
    • test/: 测试代码目录。
      • java/: Java 测试代码目录。
        • com/maxiaofa/hosts/: 具体测试代码。

2. 项目的启动文件介绍

GitHub Hosts 项目的主要启动文件是 hosts 文件。该文件包含了用于加速 GitHub 访问的 IP 地址映射。

hosts 文件内容示例

#Github Hosts Start
#Update Time: 2024-08-07
#Project Address: https://github.com/maxiaof/github-hosts
#Update URL: https://raw.githubusercontent.com/maxiaof/github-hosts/master/hosts
140.82.114.25 alive.github.com
140.82.114.26 live.github.com
185.199.111.154 github.githubassets.com
140.82.114.21 central.github.com
185.199.111.133 desktop.githubusercontent.com
#Github Hosts End

启动方法

  1. hosts 文件内容复制到系统的 hosts 文件中。
  2. 刷新 DNS 缓存:
    • Windows: 打开命令提示符,执行 ipconfig /flushdns
    • Mac: 打开终端,执行 sudo killall -HUP mDNSResponder
    • Linux: 打开终端,执行 sudo systemctl restart NetworkManager

3. 项目的配置文件介绍

GitHub Hosts 项目的主要配置文件是 hosts 文件。该文件包含了用于加速 GitHub 访问的 IP 地址映射。

配置文件内容示例

#Github Hosts Start
#Update Time: 2024-08-07
#Project Address: https://github.com/maxiaof/github-hosts
#Update URL: https://raw.githubusercontent.com/maxiaof/github-hosts/master/hosts
140.82.114.25 alive.github.com
140.82.114.26 live.github.com
185.199.111.154 github.githubassets.com
140.82.114.21 central.github.com
185.199.111.133 desktop.githubusercontent.com
#Github Hosts End

配置方法

  1. hosts 文件内容复制到系统的 hosts 文件中。
  2. 刷新 DNS 缓存:
    • Windows: 打开命令提示符,执行 ipconfig /flushdns
    • Mac: 打开终端,执行 sudo killall -HUP mDNSResponder
    • Linux: 打开终端,执行 sudo systemctl restart NetworkManager

通过以上步骤,您可以成功配置和使用 GitHub Hosts 项目,加速 GitHub 访问。

登录后查看全文
热门项目推荐
相关项目推荐