GitHub DNS Helper 是一个专精于解决 GitHub 访问问题的助手技能,其核心用途是修复 GitHub 相关的 DNS 解析与连接问题。当用户遇到 GitHub 无法访问、DNS 解析失败、连接超时等问题时,可以使用此技能。
主要能力: 该技能通过运行 Python 脚本对系统 hosts 文件进行修改,以修复 GitHub 的 DNS 解析。它提供自动修复、仅检查连接状态、使用自定义 hosts 源三种使用方式,并可查看帮助信息。
使用方式:
- 自动修复:直接运行脚本 python3 {{skill_path}}/scripts/fix_github_dns.py
- 仅检查连接状态:运行 python3 {{skill_path}}/scripts/fix_github_dns.py --check
- 使用自定义 hosts 源:运行 python3 {{skill_path}}/scripts/fix_github_dns.py -u "https://your-custom-url.com/hosts"
- 查看帮助:运行 python3 {{skill_path}}/scripts/fix_github_dns.py --help
权限配置(首次使用需要一次): 修改 hosts 文件需要管理员权限。脚本在执行修改前,需要先配置 hosts 文件权限,仅需一次。检测操作系统的命令为:python3 -c "import platform; print(platform.system())",输出结果为 Windows、Darwin (macOS) 或 Linux。
macOS 下执行: sudo chown $(whoami):staff /etc/hosts sudo chmod 644 /etc/hosts
Linux 下执行: sudo chown $(whoami):$(whoami) /etc/hosts sudo chmod 644 /etc/hosts
Windows 下无需配置权限,直接以管理员身份运行命令提示符或 PowerShell 即可。
资料提示,该权限操作建议由用户在系统终端中自行执行。执行后,脚本将不再需要 sudo 权限,可以免密码运行。
适用场景: 适用于因 DNS 解析问题导致无法正常访问 GitHub 的用户,尤其是需要频繁访问 GitHub 的开发者。
限制: 关于该技能支持的平台细节、脚本内部实现逻辑、失败处理方式及自定义 hosts 源的具体格式,资料暂未提供。