一键式解决Windows访问github.com不了问题

背景

作为开发人员,使用github.com上的代码工程作为第三方库是经常的事情。但因为特殊原因,访问不了github网站。网络上有很多方法,比如修改host方法,但可访问地址的IP不稳定。github.com的网络代理也可以用。近日出于需要配置Claude code skill(.claude.skill)需要,研究了下访问配置,经过 五一假期连续3天的测试,证明配置方法有效,现在共享出来。

一键式访问github.com脚本

请将以下脚本保存为.bat文件,以管理员身份执行。

bash 复制代码
@echo off
chcp 65001
echo ======================================
echo    Win10 一键修复 GitHub 无法访问
echo ======================================
echo.

:: 写入最新GitHub hosts映射
echo 正在更新 Hosts...
echo.>>C:\Windows\System32\drivers\etc\hosts
echo # GitHub Start>>C:\Windows\System32\drivers\etc\hosts
echo 140.82.112.3    github.com>>C:\Windows\System32\drivers\etc\hosts
echo 199.232.69.194  github.global.ssl.fastly.net>>C:\Windows\System32\drivers\etc\hosts
echo 185.199.108.133 raw.githubusercontent.com>>C:\Windows\System32\drivers\etc\hosts
echo 185.199.109.133 avatars.githubusercontent.com>>C:\Windows\System32\drivers\etc\hosts
echo # GitHub End>>C:\Windows\System32\drivers\etc\hosts

:: 刷新DNS缓存
echo 正在刷新DNS缓存...
ipconfig /flushdns

:: 清除Git代理(解决git clone失败)
echo 清除Git全局代理...
git config --global --unset http.proxy 2>nul
git config --global --unset https.proxy 2>nul

echo.
echo ✅ 修复完成!
echo 关闭浏览器重新打开 GitHub 即可
pause

访问效果

相关推荐
逛逛GitHub1 小时前
自测会不会被 Claude Code 标记为中国用户,有人做了个网页。
github
逛逛GitHub1 小时前
终于有个非 AI 相关的项目登上 GitHub 热榜,高低得推荐一下。
github
Lion093 小时前
【04】50 行代码实现最小 Agent:不依赖任何框架
人工智能·github
狂炫冰美式5 小时前
凌晨睡不着,我给台风巴威写了个追踪网站
前端·后端·github
海天鹰7 小时前
WIN10修改窗口标题栏失去焦点背景色
windows
Maynor9967 小时前
GitHub 外链 / 自荐入口清单
github
梦帮科技8 小时前
GRAVIS v5.5:向硬核桌面端进化与云端多节点容灾部署实践
windows·架构·rust·自动化·区块链·智能合约·数字货币
oscar9998 小时前
3.4 Nginx 负载均衡——动态再平衡的反人性纪律
nginx·github·负载均衡·财富源代码
杨超越luckly8 小时前
Agent 应用指南:基于 OurAirports 的中国机场设施数据可视化
python·html·github·可视化·机场设施
Maynor在掘金8 小时前
憋了两个月,Gemini 3.5 Pro 终于要来了!前端代码一次生成,传闻 7 月 17 日亮相。
github