Giter Site home page Giter Site logo

zyzhang827 / fetch-github-hosts Goto Github PK

View Code? Open in Web Editor NEW

This project forked from licoy/fetch-github-hosts

0.0 0.0 0.0 27 KB

🌏 获取github的hosts,以解决各种访问慢、卡、加载失败的问题,一键使用方便快捷!

Home Page: https://hosts.gitcdn.top

License: GNU General Public License v3.0

PHP 15.73% Hack 84.27%

fetch-github-hosts's Introduction

介绍

fetch-github-hosts是主要为解决研究及学习人员访问Github过慢或其他问题而提供的免费的Github hosts同步服务。

本项目部分参考于 Github520 , 但与之不同的是前者是通过ipaddress.com获取github.comhosts, 而此项目是通过部署本身的服务器来获取github.comhosts,所以在IP节点上会存在一定的差异。

使用方法

手动

添加hosts

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

  • Linux / MacOS hosts路径:/etc/hosts
  • Windows hosts路径:C:\Windows\System32\drivers\etc\hosts

刷新生效

  • Linux: /etc/init.d/network restart
  • Windows: ipconfig /flushdns
  • Macos: sudo killall -HUP mDNSResponder

Unix/Linux 一键使用

sed -i "/# fetch-github-hosts begin/Q" /etc/hosts && curl https://hosts.gitcdn.top/hosts.txt >> /etc/hosts

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

Chrome

使用 FasterHosts 插件,若访问速度过慢可以直接使用 点击此处 来进行下载。

下载完成之后解压压缩包,Chrome地址栏输入chrome://extensions/回车进入,勾选开发者模式,选择加载已解压的扩展程序, 选择刚才的解压目录即可。

Windows /MacOS 及其他桌面端

使用 SwitchHosts 桌面端应用,安装添加新规则:

  • Title: 任意
  • Type: Remote
  • Url: https://hosts.gitcdn.top/hosts.txt
  • Auto refresh: 1 hour

私有部署

下载本仓库的代码:fetch-github-hosts.zip , 部署到任意一个含有PHP环境的服务器即可,部署完成之后可以计划任务脚本定时更新hosts:

cd /wwwroot/fetch-github-hosts #此处更换为你部署的项目路径
php fetch_hosts.php

注意:必须部署到非大陆的服务器节点!

开源协议

GPL 3.0

fetch-github-hosts's People

Contributors

licoy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.