github访问失败

1. 问题场景

今天了解到notepad++可以安装许多插件,但是自动下载插件时总是失败,这些插件的下载源都是github,将地址复制到浏览器也打不开,所以查了下github的访问问题,目前插件已正常下载。
notepad++插件

2. 解决方法

  1. gitee上搜索github520,这是github上开源的一个项目,其中保存有一份host文件,定期更新,该文件记录了访问github所使用的所有相关域名的IP地址,文件内容如下。
# GitHub520 Host Start
140.82.114.25                 alive.github.com
140.82.112.5                  api.github.com
185.199.110.153               assets-cdn.github.com
185.199.108.133               avatars.githubusercontent.com
185.199.108.133               avatars0.githubusercontent.com
185.199.108.133               avatars1.githubusercontent.com
185.199.108.133               avatars2.githubusercontent.com
185.199.108.133               avatars3.githubusercontent.com
185.199.108.133               avatars4.githubusercontent.com
185.199.108.133               avatars5.githubusercontent.com
185.199.108.133               camo.githubusercontent.com
140.82.112.22                 central.github.com
185.199.108.133               cloud.githubusercontent.com
140.82.114.9                  codeload.github.com
140.82.114.21                 collector.github.com
185.199.108.133               desktop.githubusercontent.com
185.199.111.133               favicons.githubusercontent.com
140.82.113.3                  gist.github.com
54.231.163.97                 github-cloud.s3.amazonaws.com
52.216.40.233                 github-com.s3.amazonaws.com
52.217.49.196                 github-production-release-asset-2e65be.s3.amazonaws.com
16.182.72.249                 github-production-repository-file-5c1aeb.s3.amazonaws.com
52.216.59.25                  github-production-user-asset-6210df.s3.amazonaws.com
192.0.66.2                    github.blog
140.82.114.3                  github.com
140.82.112.18                 github.community
185.199.109.154               github.githubassets.com
151.101.1.194                 github.global.ssl.fastly.net
185.199.110.153               github.io
185.199.108.133               github.map.fastly.net
185.199.110.153               githubstatus.com
140.82.114.25                 live.github.com
185.199.108.133               media.githubusercontent.com
185.199.110.133               objects.githubusercontent.com
13.107.42.16                  pipelines.actions.githubusercontent.com
185.199.108.133               raw.githubusercontent.com
185.199.108.133               user-images.githubusercontent.com
13.107.246.40                 vscode.dev
140.82.114.21                 education.github.com


# Update time: 2023-11-22T08:53:27+08:00
# Update url: https://raw.hellogithub.com/hosts
# Star me: https://github.com/521xueweihan/GitHub520
# GitHub520 Host End
  1. 最新的hosts文件也可以点这里下载https://raw.hellogithub.com/hosts
  2. 将该文件内容追加到系统hosts文件末尾,以下列举了不同操作系统的hosts文件的位置,该步骤需要管理员权限。
  • Windows 系统:C:\Windows\System32\drivers\etc\hosts
  • Linux 系统:/etc/hosts
  • Mac(苹果电脑)系统:/etc/hosts
  • Android(安卓)系统:/system/etc/hosts
  • iPhone(iOS)系统:/etc/hosts
  1. 修改hosts文件后,访问https://github.com/就非常流畅了。
  2. 如未生效可尝试下面的办法,刷新 DNS,或重启电脑。
  • Windows:在 CMD 窗口输入:ipconfig /flushdns
  • Linux 命令:sudo nscd restart,如报错则须安装:sudo apt install nscd 或 sudo /etc/init.d/nscd restart
  • Mac 命令:sudo killall -HUP mDNSResponder
  1. GitHub上有个SwitchHosts项目,这是一个应用程序,可用于帮助修改系统hosts文件,可以去这里下载编译好的安装版本https://github.com/oldj/SwitchHosts/releases。按照如下配置,则SwitchHosts会定时从网上下载最新的hosts信息,并追加到系统hosts文件中。
  • Title: 随意
  • Type: Remote
  • URL: https://raw.hellogithub.com/hosts
  • Auto Refresh: 最好选 1 hour
    SwitchHosts配置

3. github镜像网站

对于网页访问以及URL下载github上的文件时,可能会出现访问不了,打开缓慢的问题,此时我们将网址或URL中https://github.com替换为镜像网站的域名,即可正常访问和下载了。
官方:https://github.com/espressif/openocd-esp32
kkgithub镜像:https://kkgithub.com/espressif/openocd-esp32
githubfast镜像:https://githubfast.com/espressif/openocd-esp32,访问这个镜像网址,显示To prevent abuse, only git is allowed,也即目前只能用于git下载。
hscsec镜像:https://github.hscsec.cn/espressif/openocd-esp32,这个目前访问超时。
521github镜像:https://521github.com/espressif/openocd-esp32
gitclone镜像:https://gitclone.com/espressif/openocd-esp32,这个目前访问超时。

4. 参考

Github国内镜像详解
【2024-01】GitHub官网太慢了,亲测最新GitHub镜像加速网站,速度快,保证能用。

  • 24
    点赞
  • 30
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值