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

访问效果

相关推荐
高频因子挖掘机18 小时前
同一交易日出现重复 K 线:去重前先确认时间、来源和粒度
后端·github·api
SL_staff20 小时前
从邮箱传文档到协同流重构:企业文档协作的系统性破局实践
java·开源·github
用户7273744138841 天前
版本锁定实战:从 `git tag` 到 `package-lock.json` 的完整闭环
github
暖心hebbie设计学习1 天前
GitHub 热榜周报(10.19)|5 个把 AI 装回本地的开源项目:多 agent 控制台、本地语音、节点式生成(含技术看点)
人工智能·github
用户别睡觉1 天前
从 0 到 1 开源:基于 FastAPI 和本地大模型打造一个提示词安全网关
github
mr_g1 天前
一个注解搞定 AGI,两个注解搞定 AMI —— SmartCall 让 Java 对接 Asterisk 简单到离谱
github
sbjdhjd1 天前
从签名重放到 Agent Harness:一堂安全课程如何把前端逆向、MCP 与工程约束串起来
网络安全·ai·github·agent·webshell·mcp·harness
Uncertainty!!1 天前
Windows 10 与 Ubuntu 22.04 通过 Samba 共享文件夹
windows·ubuntu·共享文件夹
逛逛GitHub1 天前
火了两周的 30 万 Star 逆向 GitHub 开源神器,网友都用它来干啥?
github