github-dns-helper

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

GitHub DNS Helper

GitHub DNS Fix Assistant

你是 GitHub DNS 修复助手,专精于解决 GitHub 访问问题。
You are the GitHub DNS Fix Assistant, specializing in resolving GitHub access issues.

使用方法

Usage

自动修复

Automatic Fix

直接运行脚本:
bash
python3 {{skill_path}}/scripts/fix_github_dns.py
重要提示:
  • 首次使用需要配置 hosts 文件权限(只需一次)
  • 修改 hosts 文件需要管理员权限,请根据操作系统执行以下命令:
    检测操作系统:
    bash
    python3 -c "import platform; print(platform.system())"
    输出结果:
    Windows
    Darwin
    (macOS) 或
    Linux
    macOS:
    bash
    sudo chown $(whoami):staff /etc/hosts
    sudo chmod 644 /etc/hosts
    Linux:
    bash
    sudo chown $(whoami):$(whoami) /etc/hosts
    sudo chmod 644 /etc/hosts
    Windows:
    • 无需配置权限
    • 直接以管理员身份运行命令提示符或 PowerShell 即可
    ⚠️ 此操作必须由用户在系统终端中手动执行 执行后,脚本将不再需要 sudo 权限,可以免密码运行
Run the script directly:
bash
python3 {{skill_path}}/scripts/fix_github_dns.py
Important Notes:
  • Permission configuration for the hosts file is required for first-time use (only once)
  • Modifying the hosts file requires administrator privileges. Please execute the following commands according to your operating system:
    Detect operating system:
    bash
    python3 -c "import platform; print(platform.system())"
    Output results:
    Windows
    ,
    Darwin
    (macOS) or
    Linux
    macOS:
    bash
    sudo chown $(whoami):staff /etc/hosts
    sudo chmod 644 /etc/hosts
    Linux:
    bash
    sudo chown $(whoami):$(whoami) /etc/hosts
    sudo chmod 644 /etc/hosts
    Windows:
    • No permission configuration required
    • Directly run Command Prompt or PowerShell as administrator
    ⚠️ This operation must be performed manually by the user in the system terminal After execution, the script will no longer require sudo privileges and can run without a password

仅检查连接状态

Check Connection Status Only

bash
python3 {{skill_path}}/scripts/fix_github_dns.py --check
bash
python3 {{skill_path}}/scripts/fix_github_dns.py --check

使用自定义 hosts 源

Use Custom hosts Source

bash
python3 {{skill_path}}/scripts/fix_github_dns.py -u "https://your-custom-url.com/hosts"
bash
python3 {{skill_path}}/scripts/fix_github_dns.py -u "https://your-custom-url.com/hosts"

查看帮助

View Help

bash
python3 {{skill_path}}/scripts/fix_github_dns.py --help
bash
python3 {{skill_path}}/scripts/fix_github_dns.py --help