Back to home@iTrimut

dsh-GitHub-Road

dsh-GitHub-Road: stable github.com access for mainland China (hosts pin + rotating-IP dual-gate + 30-min self-heal) - Agent Skill plugin for DeepSeek Harness

Stars
0
Language
PowerShell
Created
Aug 28, 2026
Updated
Aug 28, 2026
GitHub repo

Introduction

🛣️ dsh-GitHub-Road

让普通用户在中国大陆稳定访问 GitHub 官网的 Agent Skill 插件包:hosts 直连 + 动态 IP 择优 + 计划任务自动自愈,免代理、零费用。

An Agent Skill plugin that gives ordinary users in mainland China reliable access to github.com: hosts pin + rotating-IP selection (dual gate: TLS handshake and real HTTP 200) + a scheduled 30-minute self-heal task. No proxy, no cost.

License: MIT DSH Plugin


它是做什么的 / What it does

浏览器打不开 github.com(转圈/超时/连接被重置)?运营商对 GitHub 按 IP 做 TLS/SNI 层封锁,且封锁的 IP 集合会随时间轮换——所以"写死一个 IP 到 hosts"注定过段时间失效。本方案:

  1. 双重验证选 IP:候选 IP 先过 TLS 握手(8 秒硬超时 + TLS 1.2 + 证书域名校验),再发真实 HTTPS 请求,必须返回 HTTP 200 才算可用(避免选到握手正常但返回 400/404 的错误前端)。
  2. 写入 hosts 并刷新 DNS:自动备份、原子写入、保留 Tailscale/公司 VPN 等其它条目。
  3. 计划任务自愈:每 30 分钟自动重跑,当前 IP 被封锁后最多 30 分钟自动切换
  4. 全挂回退 DNS:所有候选都不可用时临时注释 hosts 条目,不钉死坏 IP。

方案经两轮独立第三方审查修正,全部步骤在真实环境(Windows 11 中文版、国内网络)验证。


安装 / Install

方式一:作为 dsh 插件安装(推荐)

dsh plugin --profile web add github:iTrimut/dsh-GitHub-Road

重启 dsh web,确认技能已生成:

ls "%USERPROFILE%\.dsh\skills\dsh-GitHub-Road\SKILL.md"

之后让 dsh 代理执行技能即可,或在插件目录手动运行:

# 把文件复制到无空格路径(如 D:\GitHubRoad\)
# 双击 install-github-fix.ps1 → UAC 点「是」→ 完成

方式二:手动安装(不依赖 dsh)

  1. 从本仓库 skills/dsh-GitHub-Road/files/ 下载 fix-github.ps1install-github-fix.ps1fix-github-quiet.vbs 到同一个文件夹(路径不要含空格,如 D:\GitHubRoad\)。
  2. 双击 install-github-fix.ps1 → UAC 弹窗点「是」。
  3. 黑色窗口自动完成:立即修复 + 注册每 30 分钟的计划任务(隐藏窗口,允许电池、错过补跑)。
  4. 重启浏览器(或 Ctrl+F5)访问 https://github.com。

卸载 / Uninstall

双击 uninstall-github-fix.ps1(删除计划任务,保留当前 hosts 条目)。


验证 / Verify

curl.exe -s -o NUL -w "%{http_code}" https://github.com   # 期望 200
schtasks /query /tn DSH-GitHubFix                           # 期望 Ready,Next Run 在未来

已知限制 / Limitations(如实说明)

  • gist.github.com:SNI 被运营商层阻断,所有 IP 都连不上,hosts 无法修复,需要代理。
  • codeload.github.com(下载源码压缩包)、ssh github.com:22(Git 推送)、GitHub Desktop 安装包:不在本方案覆盖范围。Git 推送被墙请用 SSH over 443(见 dsh-GitRoad)。
  • 候选 IP 列表是手工维护的;GitHub 的 Azure 段偶尔变化,全部失效时脚本自动回退 DNS 并提示。可更新脚本中 $githubCandidates(用 nslookup github.com + 逐 IP 实测 HTTP 200)。
  • 若运营商升级为"对 github.com 全量封锁",本方案会如实报告失败并建议代理——不承诺万无一失

安全说明 / Security

  • 脚本以管理员权限运行并每 30 分钟自动执行:不要修改脚本内容(被篡改 = 定时执行任意管理员命令);只从本仓库获取脚本。
  • 建议把脚本所在文件夹设为仅管理员可写: icacls "D:\GitHubRoad" /inheritance:r /grant:r "Administrators:(OI)(CI)F" "Users:(OI)(CI)RX"
  • hosts 每次修改前自动备份到 %USERPROFILE%\hosts.backup-*(保留最近 20 份)。
  • 所有脚本 UTF-8 带 BOM、纯 ASCII 引号(Windows PowerShell 5.1 直接可跑)。

免责声明 / Disclaimer

本工具仅用于个人学习与开发环境的网络配置(等价于常见的 hosts 加速工具)。请在遵守当地法律法规的前提下使用;不建议用于公司/受管设备,大规模分发可能面临法律风险。本项目与 GitHub 官方无关。


文档 / Docs

完整操作手册、排查表与审查记录见 skills/dsh-GitHub-Road/SKILL.md(安装技能后随技能加载)。