github被墙是DNS污染,IP并没有封杀。所以可以修改hosts文件即可访问github。
这里推荐一个开源项目GitHub Hosts
GitHub Hosts主站: https://github.com/ineo6/hosts
GitHub Hosts镜像: https://gitee.com/ineo6/hosts

内容写入hosts文件即可

Update at: 2021-11-08 20:17:20

# GitHub Host Start

185.199.108.154              github.githubassets.com
140.82.113.22                central.github.com
185.199.108.133              desktop.githubusercontent.com
185.199.108.153              assets-cdn.github.com
185.199.108.133              camo.githubusercontent.com
185.199.108.133              github.map.fastly.net
199.232.69.194               github.global.ssl.fastly.net
140.82.113.3                 gist.github.com
185.199.108.153              github.io
140.82.112.3                 github.com
140.82.114.5                 api.github.com
185.199.108.133              raw.githubusercontent.com
185.199.108.133              user-images.githubusercontent.com
185.199.108.133              favicons.githubusercontent.com
185.199.108.133              avatars5.githubusercontent.com
185.199.108.133              avatars4.githubusercontent.com
185.199.108.133              avatars3.githubusercontent.com
185.199.108.133              avatars2.githubusercontent.com
185.199.108.133              avatars1.githubusercontent.com
185.199.108.133              avatars0.githubusercontent.com
185.199.108.133              avatars.githubusercontent.com
140.82.112.9                 codeload.github.com
52.217.41.12                 github-cloud.s3.amazonaws.com
52.217.170.161               github-com.s3.amazonaws.com
52.216.245.116               github-production-release-asset-2e65be.s3.amazonaws.com
52.217.164.81                github-production-user-asset-6210df.s3.amazonaws.com
52.217.129.145               github-production-repository-file-5c1aeb.s3.amazonaws.com
185.199.108.153              githubstatus.com
64.71.144.202                github.community
185.199.108.133              media.githubusercontent.com

# GitHub Host End

然后刷新一下DNS缓存

mac 命令

sudo killall -HUP mDNSResponder

win 命令

ipconfig /flushdns

当然每次都手动改hosts太愚蠢了,这里推荐一个工具SwitchHosts!

通过 SwitchHosts! 自动更新的方法:

1,安装SwitchHosts

2,添加一条本地规则:把之前的内容(例如一些屏蔽软件激活之类的规则)写在里面。

3,在添加一条远程规则:

方案名:GitHub(可以自行命名)
类型:远程
URL 地址:https://gitee.com/ineo6/hosts/raw/master/hosts
自动更新:1个小时

这样就可以和最新的hosts保持同步。