github-hosts-cn

GitHub Hosts 更新工具(中国用户专用)。安全地更新系统hosts文件以访问GitHub,保留原有非GitHub条目,仅替换GitHub相关地址。支持备份恢复、风险提示。当用户需要解决GitHub访问问题时使用此技能。

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "github-hosts-cn" with this command: npx skills add n1e/github-hosts-cn-n1e

GitHub Hosts CN - 中国用户专用 GitHub Hosts 更新工具

安全、智能地更新系统hosts文件,帮助中国用户正常访问GitHub。

🌟 特性

  • 🛡️ 安全优先:自动备份、保留原有配置、仅替换GitHub条目
  • 🌍 多源获取:从多个镜像源获取最新GitHub hosts(HelloGitHub、GitLab、Gitee等)
  • ⚡ 自动选择:并行测试所有源,使用最快的可用源
  • 💾 智能备份:时间戳备份,支持一键恢复
  • 🔍 精确替换:只替换GitHub相关域名,保留其他所有hosts配置
  • 📋 风险提示:执行前显示详细风险说明,需用户确认

📦 安装

cd /Users/claw/Documents/trae_projects/skills/github-hosts-cn
npm install

🚀 使用方法

# 更新GitHub hosts
node update.js

# 查看帮助
node update.js --help

# 恢复最近的备份
node update.js --restore

# 查看当前状态
node update.js --status

# 仅获取不更新(预览模式)
node update.js --preview

📊 数据源

URL类型优先级
HelloGitHubraw.hellogithub.com独立站点1
GitLab Mirrorgitlab.com/ineo6GitLab2
Gitee Mirrorgitee.com国内镜像3
JSDelivr CDNcdn.jsdelivr.netCDN4

🔧 工作流程

1. 显示风险提示 → 用户确认
2. 读取当前 /etc/hosts
3. 创建时间戳备份
4. 从多源获取最新GitHub hosts
5. 合并:保留非GitHub条目 + 新GitHub条目
6. 写入新的hosts文件
7. 刷新DNS缓存
8. 显示更新结果

🛡️ 安全机制

备份策略

  • 每次修改前自动备份
  • 备份文件命名:hosts.backup.YYYY-MM-DDTHH-mm-ss
  • 备份位置:~/.openclaw/backups/github-hosts/
  • 保留最近10个备份文件

合并策略

  • 识别所有GitHub相关域名(github.com, github.global.ssl.fastly.net等)
  • 保留hosts文件中的所有非GitHub条目
  • 仅替换GitHub相关IP地址

恢复机制

  • --restore 恢复最近备份
  • --restore <backup-file> 恢复指定备份

⚠️ 风险说明

修改hosts文件存在以下风险:

  1. 权限风险:需要sudo权限,请确保在可信环境执行
  2. 网络风险:错误的hosts可能导致无法访问某些网站
  3. IP失效风险:GitHub IP可能随时变化,需要定期更新
  4. 备份风险:请确保备份目录可写

建议:

  • 在执行前理解hosts文件的作用
  • 定期检查备份文件
  • 如遇问题立即使用 --restore 恢复

📋 系统要求

  • Node.js 16+
  • macOS / Linux
  • sudo权限(用于修改/etc/hosts)
  • 网络连接

📜 License

MIT

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

Wcs Helper Network Skill

SSH tunnel for China servers to access internationally blocked sites (GitHub, ClawHub, HuggingFace, arXiv, Google, YouTube). Password-auth based, one-command...

Registry Source
1000Profile unavailable
Coding

Free DDNS

RunDDNS 动态域名解析服务 - 简单、快速、免费的动态域名解析

Registry SourceRecently Updated
1160Profile unavailable
General

AdGuard Home Manager

Manage AdGuard Home network-wide DNS ad blocking. Query blocklist stats, add/remove custom DNS rules, check filtering status, and view top blocked domains fr...

Registry Source
1080Profile unavailable
Security

DNS Robot

Run DNS, email security, SSL, WHOIS, and network tools via dnsrobot.net API — no API key required

Registry Source
2150Profile unavailable
github-hosts-cn | V50.AI