关于运维:国内用户访问-Github-速度慢怎么办别慌一招帮你解决看这

3次阅读

共计 2964 个字符,预计需要花费 8 分钟才能阅读完成。

对于咱们从事 IT 行业的技术人员来说,对于 Github 必定是十分相熟的。日常工作中必备的工具之一,因为时常遇到无法访问、或者访问速度很慢的问题,导致应用起来十分的不便。所以,明天给大家介绍一款软件:fetch-github-hosts。

简介

fetch-github-hosts 它是一款同步 github hosts 的工具,能够解决国内无法访问 GitHub 的问题。性能十分弱小,跨平台,反对 Windows、Mac 和 Linux 端,UI 十分丑陋!此我的项目是通过部署此我的项目自身的服务器来获取 github.com 的 hosts,而不是通过第三方 ip 地址接口来进行获取,例如 ipaddress.com 等。

时隔一年大更新 v2.6 公布,将 fetch-github-hosts 的依赖及 UI 界面进行了大更新,减少了一些十分实用的性能。

  • 开源地址:https://github.com/Licoy/fetch-github-hosts

装置与应用

装置与应用都十分的简略、易用。

  • 下载地址:https://github.com/Licoy/fetch-github-hosts/releases

Windows 端

下载相应的安装包

双击运行之后的界面如下:点击启动之后显示如下:这时你再拜访 Github 就不会呈现之前的超时景象了。

抉择客户端的主机源:你也能够自定义主机源:

服务端模式:

命令行终端

目前反对 Windows/Linux/MacOS。具体的应用能够参考:https://github.com/Licoy/fetch-github-hosts/blob/main/README.md 官网文档介绍,这里就不再赘述了,非常简单。

手动增加 Hosts 文件

须要咱们手动拜访 https://hosts.gitcdn.top/hosts.txt,而后将上面的全部内容粘贴到你的 hosts 文件中即可。

# fetch-github-hosts begin
140.82.113.26               alive.github.com
140.82.113.26               live.github.com
185.199.108.154             github.githubassets.com
140.82.114.21               central.github.com
185.199.110.133             desktop.githubusercontent.com
2606:50c0:8001::153         assets-cdn.github.com
185.199.110.133             camo.githubusercontent.com
185.199.109.133             github.map.fastly.net
146.75.105.194              github.global.ssl.fastly.net
140.82.113.3                gist.github.com
185.199.111.153             github.io
140.82.113.3                github.com
192.0.66.2                  github.blog
140.82.112.5                api.github.com
2606:50c0:8002::154         raw.githubusercontent.com
2606:50c0:8002::154         user-images.githubusercontent.com
185.199.109.133             favicons.githubusercontent.com
185.199.109.133             avatars5.githubusercontent.com
185.199.108.133             avatars4.githubusercontent.com
185.199.109.133             avatars3.githubusercontent.com
185.199.108.133             avatars2.githubusercontent.com
185.199.111.133             avatars1.githubusercontent.com
185.199.109.133             avatars0.githubusercontent.com
2606:50c0:8001::154         avatars.githubusercontent.com
140.82.114.9                codeload.github.com
54.231.163.161              github-cloud.s3.amazonaws.com
52.216.54.233               github-com.s3.amazonaws.com
54.231.133.153              github-production-release-asset-2e65be.s3.amazonaws.com
52.216.104.235              github-production-user-asset-6210df.s3.amazonaws.com
3.5.16.126                  github-production-repository-file-5c1aeb.s3.amazonaws.com
185.199.109.153             githubstatus.com
140.82.114.18               github.community
52.224.38.193               github.dev
140.82.114.22               collector.github.com
2620:1ec:21::16             pipelines.actions.githubusercontent.com
2606:50c0:8001::154         media.githubusercontent.com
185.199.111.133             cloud.githubusercontent.com
185.199.111.133             objects.githubusercontent.com
# last fetch time: 2023-08-20 11:42:51
# update url: https://hosts.gitcdn.top/hosts.txt
# fetch-github-hosts end
  • Linux / MacOS 零碎 hosts 文件目录:/etc/hosts
  • Windows hosts 文件目录:C:\Windows\System32\drivers\etc\hosts

注:下面的文件内容是动静更新的(last fetch time: 2023-08-20 11:42:51),你能够应用定时工作去更新即可。

增加完文件之后,咱们须要进行手动刷新动作,能力是使之失效,具体操作如下:

# Linux
/etc/init.d/network restart

# Windows
ipconfig /flushdns

# Macos
sudo killall -HUP mDNSResponder

Unix/Linux 零碎,咱们还能够应用上面的命令实现主动增加、主动刷新,一键启动与应用。

sed -i "/# fetch-github-hosts begin/Q" /etc/hosts && curl https://hosts.gitcdn.top/hosts.txt >> /etc/hosts

图形界面的应用还是非常简单、不便的,总体应用下来,个人感觉还是一款十分不错的软件,减速成果非常明显。

有趣味的敌人能够下载体验,如果你有更好的减速工具,也欢送你在评论区分享一下,大家一起学习,共同进步。

正文完
 0