一键式解决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

访问效果

相关推荐
miofly2 小时前
GitHub 日榜趋势速报 | 2026-11-10
开源·github
Yingyingyingyyy2 小时前
GitHub 开源热榜项目-周榜(2026-11-09)
开源·github
叼烟扛炮11 小时前
[LangChain] 学习笔记(06):突破大模型限制——结构化输出(Structured Output)
windows·笔记·学习·langchain
孟郎郎13 小时前
打造一切(Craft Anything)——克隆构造世间万物
人工智能·ai·github·软件构建·开源软件
海洋之恒14 小时前
GitHub Actions 自动化:5 个真实运维提效案例
运维·自动化·github
小Z先生15 小时前
我用 Go + 系统 WebView 写了个纯本地 Postman:不装 Electron、不连云端
后端·github
fthux21 小时前
待办清单写满了,别忘了给休息留个位置:试试 Tick Rest
开源·github·mac·提醒·open source·消息提醒·tick rest·tick rest for mac·消息提醒app
Thneonl1 天前
桌宠穿透不是一行 SetWindowLong
windows·程序员
GitHub实测笔记1 天前
dust 本机实测:/usr 扫树中位 92ms、du -sh 80ms;-s 不是汇总,稀疏文件 0→100Mi
github
逛逛GitHub1 天前
有个刚开源的 GitHub 项目有说法,竟然能在终端里再跑一台 Mac。
github