/install github-hosts-windows
GitHub Hosts Optimizer
On Windows, directly modify C:\Windows\System32\drivers\etc\hosts to map GitHub domains to faster IPs.
Workflow
-
Resolve GitHub IPs using
nslookup:- github.com
- api.github.com
- objects.githubusercontent.com
-
Ping each IP to measure latency (ping -n 3 \x3CIP>)
-
Select fastest IP (lowest average latency)
-
Update hosts file with entries:
\x3Cfastest_ip> github.com \x3Cfastest_ip> api.github.com \x3Cfastest_ip> github.com (duplicate for reliability) -
Flush DNS cache:
ipconfig /flushdns
PowerShell Script
$hostsPath = "$env:SystemRoot\System32\drivers\etc\hosts"
$domains = @("github.com", "api.github.com", "objects.githubusercontent.com")
# Resolve IPs
$ips = @{}
foreach ($domain in $domains) {
$result = nslookup $domain 2>$null
$ips[$domain] = ($result | Select-String -Pattern "Addresses:" -Context 0,10 | ForEach-Object { $_.Context.PostContext }) -replace '\s+', '' | Where-Object { $_ -match '^\d+\.\d+\.\d+\.\d+$' }
}
# Ping each IP and find fastest
$results = @()
foreach ($ip in ($ips.Values | Select-Object -Unique)) {
$avg = (ping -n 3 $ip | Select-String -Pattern "平均").ToString() -replace '.*= (\d+)ms.*', '$1'
if ($avg) { $results += [PSCustomObject]@{ IP = $ip; Avg = [int]$avg } }
}
$fastest = ($results | Sort-Object Avg | Select-Object -First 1).IP
# Update hosts
$entry = "$fastest github.com`n$fastest api.github.com"
$current = Get-Content $hostsPath -Raw -ErrorAction SilentlyContinue
if ($current -notmatch "github\.com") {
Add-Content -Path $hostsPath -Value $entry
} else {
$updated = $current -replace "[\d\.]+\s+github\.com`n?[\d\.]+\s+api\.github\.com", $entry
Set-Content -Path $hostsPath -Value $updated
}
# Flush DNS
ipconfig /flushdns | Out-Null
Write-Host "Done! Fastest IP: $fastest"
Key Notes
- Hosts file requires Administrator privileges to modify
- If direct edit fails, output the entry and instruct user to manually add it
- The fastest IP may change over time; re-run when GitHub access slows again
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install github-hosts-windows - After installation, invoke the skill by name or use
/github-hosts-windows - Provide required inputs per the skill's parameter spec and get structured output
What is github改hosts文件加速skill,仅针对windows?
Optimize GitHub access speed on Windows by finding the fastest IPs and updating the hosts file to reduce latency. It is an AI Agent Skill for Claude Code / OpenClaw, with 73 downloads so far.
How do I install github改hosts文件加速skill,仅针对windows?
Run "/install github-hosts-windows" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is github改hosts文件加速skill,仅针对windows free?
Yes, github改hosts文件加速skill,仅针对windows is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does github改hosts文件加速skill,仅针对windows support?
github改hosts文件加速skill,仅针对windows is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created github改hosts文件加速skill,仅针对windows?
It is built and maintained by qz (@vay-qz); the current version is v1.0.0.