「自学哈网」GitHub 加速访问N种方法
GitHub 在国内常常打不开,其实部分地区是可以直接访问的,虽然第一次可能会打不开,多刷新几下就能打开。至于当地完全无法访问GitHub,使用下面的方法。
一、修改系统Hosts文件
打开https://www.ip138.com/
查询以下三个链接的DNS解析地址:
github.com
assets-cdn.github.com
github.global.ssl.fastly.net
打开电脑系统hosts文件(需管理员权限)。文件路径:C:\Windows\System32\drivers\etc
添加: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 localhost140.82.113.3 github.com
185.199.108.153 assets-cdn.github.com
199.232.69.194 github.global.ssl.fastly.net
Mac或者其它linux系统hosts文件位于/etc下,需要切入到root用户才能修改。
最后按Windows+X键打开系统命令行(管理员身份)或 powershell。
运行 ipconfig /flushdns 手动刷新系统DNS缓存。
Mac系统修改完hosts文件保存并退出就可以了,不用刷新DNS缓存。
Centos系统执行 /etc/init.d/network restart 命令,使得hosts生效。
Ubuntu系统执行 /etc/init.d/network-manager restart 命令,使得hosts生效。
如果你所在地无法打开,你也可以借助一些代理网站和代理工具。
二、通过Gitee中转fork仓库下载
gitee是国内的代码托管平台,可以通过它来远程复制GitHub的文件。
访问gitee网站(https://gitee.com/)并登录,在顶部选择“从GitHub/GitLab导入仓库”,在导入页面中粘贴你复制的Github仓库地址,点击导入。导入操作完成后,在导入的仓库中下载对应的GitHub仓库代码即可。后续你可以点击仓库顶部的“刷新”按钮进行和Github代码仓库的同步。
三、GitHub文件加速下载
1. https://gh.api.99988866.xyz/
2. http://toolwa.com/github/
3. GitHub加速工具:https://github.com/vvmcat/Github-SpeedUpTool
如果是下载比较大的项目,比如耗时5分钟以上,大于30M的文件,推荐使用代理网站下载,或者转入gitee的方式下载。
本站所有资源来源于网络,分享目的仅供大家学习和交流!如若本站内容侵犯了原著者的合法权益,可联系邮箱976157886@qq.com进行删除。
自学哈专注于免费提供最新的分享知识、网络教程、网络技术的资源分享平台,好资源不私藏,大家一起分享!
自学哈网 » 「自学哈网」GitHub 加速访问N种方法