Luke's home Luke's home
首页
  • 前端文章

    • JavaScript
页面
技术
更多
关于
收藏
  • 分类
  • 标签
  • 归档
GitHub (opens new window)

Luke xiao

K
首页
  • 前端文章

    • JavaScript
页面
技术
更多
关于
收藏
  • 分类
  • 标签
  • 归档
GitHub (opens new window)
  • git

    • 自动部署vuepress
    • 解决国内访问github速度慢的问题
      • 进入github官方cdn地址
      • 查询下面两个连接的dns解析地址
      • 修改系统hosts文件
      • 添加
        • hosts不能保存的办法
      • 刷新系统dns缓存
      • 大功告成
  • storybook创建
  • pip 国内镜像
  • 技术
  • git
lukexiao
2021-04-28

解决国内访问github速度慢的问题

由于某些原因,国内访问github会异常缓慢,在clone仓库时甚至只有10k一下的速度,下载半天也下不完。

本文介绍通过修改系统hosts文件的棒啊,绕过国内dns解析,直接访问github的cdn节点,从而达到加速的目的

# 进入github官方cdn地址

https://www.ipaddress.com/

# 查询下面两个连接的dns解析地址

github.com

github.global.ssl.fastly.net

# 修改系统hosts文件

打开系统hosts文件(管理员权限)

windows路径:C:\Windows\System32\drivers\etc

mac打开方式 sudo vim /etc/hosts

# 添加

在末尾添加三行记录并保存。注意ip地址与域名间需要有空格

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost

192.30.253.112     github.com
151.101.193.194    github.global.ssl.fastly.net
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

# hosts不能保存的办法 (opens new window)

修改hosts文件不能保存解决办法

# 刷新系统dns缓存

windows:

Windows + X 打开系统命令行(管理员身份)或者 powershell

运行 ipconfig /flushdns 手动刷新系统dns缓存 注意config后面有空格

mac:

sudo killall -HUP mDNSResponder

# 大功告成

编辑 (opens new window)
上次更新: 2021/08/13, 23:21:49
自动部署vuepress
storybook创建

← 自动部署vuepress storybook创建→

最近更新
01
流式布局
08-13
02
flex布局
08-13
03
rem布局
08-13
更多文章>
Theme by Vdoing | Copyright © 2021-2021 Evan Xu | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式