← Back to Skills Marketplace
n1e

GitHub Hosts CN

by n1e · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ⚠ suspicious
129
Downloads
0
Stars
0
Active Installs
2
Versions
Install in OpenClaw
/install github-hosts-cn-n1e
Description
GitHub Hosts 更新工具(中国用户专用)。安全地更新系统hosts文件以访问GitHub,保留原有非GitHub条目,仅替换GitHub相关地址。支持备份恢复、风险提示。当用户需要解决GitHub访问问题时使用此技能。
README (SKILL.md)

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 类型 优先级
HelloGitHub raw.hellogithub.com 独立站点 1
GitLab Mirror gitlab.com/ineo6 GitLab 2
Gitee Mirror gitee.com 国内镜像 3
JSDelivr CDN cdn.jsdelivr.net CDN 4

🔧 工作流程

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 \x3Cbackup-file> 恢复指定备份

⚠️ 风险说明

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

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

建议:

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

📋 系统要求

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

📜 License

MIT

Usage Guidance
This skill is coherent for updating GitHub host entries and includes sensible safeguards (preview, backups, restore). Before installing or running it: 1) Inspect and verify the listed data sources (raw.hellogithub.com, gitlab.com, gitee.com, jsdelivr) — if a source is compromised it can supply malicious IP mappings. 2) Use the --preview mode first to review exact changes and confirm backups exist. 3) Run in a trusted environment and avoid running with sudo in automated/unattended contexts; prefer manual confirmation. 4) Keep backups (the tool stores them under ~/.openclaw/backups/github-hosts/) and test restore. 5) If you need higher assurance, run it on a disposable/test machine or manually fetch and vet hosts content before applying. If you want me to, I can: list the exact domains the tool will change, fetch the current preview output from the fastest source (non-destructively), or help craft a checklist to vet the remote sources.
Capability Analysis
Type: OpenClaw Skill Name: github-hosts-cn-n1e Version: 1.0.1 The skill is designed to update the system hosts file to facilitate GitHub access in China, a task that inherently requires high-risk operations including sudo privileges and shell command execution (execSync) in update.js. While the code appears well-structured with safety features like automated backups, path validation, and a restore mechanism, the capability to modify core system files (/etc/hosts) and execute system-level commands (cp, dscacheutil, etc.) via an AI agent falls under the 'risky capabilities' threshold. No evidence of malicious intent, data exfiltration, or prompt injection was found; the tool functions as described using community-standard data sources like raw.hellogithub.com.
Capability Assessment
Purpose & Capability
Name/description (GitHub hosts updater for China) match what the skill does: reads /etc/hosts, fetches hosts from multiple public mirrors, merges GitHub entries, backs up, and writes the file. No unrelated credentials, binaries, or config paths are requested.
Instruction Scope
SKILL.md and update.js explicitly describe reading /etc/hosts, creating timestamped backups in ~/.openclaw/backups/github-hosts/, fetching remote hosts files, parsing/merging entries, writing /etc/hosts, and flushing DNS. The instructions are scoped to the stated task and include preview/restore options and an explicit user confirmation step.
Install Mechanism
No install script in the registry; the package is an npm project with update.js and package.json. Nothing is downloaded or executed at install time. At runtime the script fetches remote hosts data from listed public URLs (HelloGitHub, GitLab, Gitee, jsdelivr), which is expected for this function but is a trust surface to review.
Credentials
The skill requests no environment variables, no secrets, and no unrelated credentials. It does require Node.js and elevated privileges to modify /etc/hosts (documented). The requested permissions are proportional to the task.
Persistence & Privilege
The skill is not always: true and has default autonomous-invocation allowed by platform. It performs privileged actions (writing system hosts) and requires sudo; however the SKILL.md and code show an interactive confirmation and preview mode. Users should be aware that if an agent runs this skill without interactive confirmation (or with automated confirmation flags), it will perform privileged writes.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install github-hosts-cn-n1e
  3. After installation, invoke the skill by name or use /github-hosts-cn-n1e
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.1
- Maintenance update with no user-facing feature changes. - Internal update in the update.js file; documentation and skill description remain unchanged.
v1.0.0
Initial release of github-hosts-cn: a secure GitHub Hosts updating tool for users in China. - Safely updates system hosts file for GitHub access, preserving non-GitHub entries. - Features automatic and timestamped backups with easy restore options. - Fetches latest GitHub hosts from multiple sources, tests speed, and selects the fastest. - Provides risk warnings and requires user confirmation before making changes. - Maintains detailed logs and supports preview mode for changes.
Metadata
Slug github-hosts-cn-n1e
Version 1.0.1
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 2
Frequently Asked Questions

What is GitHub Hosts CN?

GitHub Hosts 更新工具(中国用户专用)。安全地更新系统hosts文件以访问GitHub,保留原有非GitHub条目,仅替换GitHub相关地址。支持备份恢复、风险提示。当用户需要解决GitHub访问问题时使用此技能。 It is an AI Agent Skill for Claude Code / OpenClaw, with 129 downloads so far.

How do I install GitHub Hosts CN?

Run "/install github-hosts-cn-n1e" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is GitHub Hosts CN free?

Yes, GitHub Hosts CN is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does GitHub Hosts CN support?

GitHub Hosts CN is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created GitHub Hosts CN?

It is built and maintained by n1e (@n1e); the current version is v1.0.1.

💬 Comments