Skip to content

Latest commit

 

History

History
 
 

下载加速Clone、AWS、Git镜像

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

github镜像地址

网速慢或被封锁,在这个镜像地址登录访问、下载也是可以的。

git下载

使用淘宝源加快国内git下载

https://npm.taobao.org/mirrors/git-for-windows/

npm/yarn下载组件方面,均可使用淘宝镜像

npm install -g cnpm --registry=https://registry.npm.taobao.org
yarn config set registry https://registry.npm.taobao.org

host

将以下host复制进C:\Windows\System32\drivers\etc\hosts,再使用命令行输入ipconfig /flushdns刷新dns缓存。目的:此host只为解除GFW对GitHub(asw、ssh)下载及克隆的网络限制干扰(不排除服务器吞吐、光缆受地理限制等原因)

详情 关于Github克隆及下载过慢的解决方案

如果某条hosts的IP、域名变更,而又没及时更新容易引发浏览器的连接错误重置指向,造成站点无法访问

详情 GitHub RST与Git SSL_ERR_SYSCALL综合分析

** 该host文件已废弃,仅作植入IP-DNS映射,阻断联网实验!**
## GitHub Start

192.30.253.112 github.com
192.30.253.113 github.com
151.101.184.133 assets-cdn.github.com
151.101.185.194 github.global.ssl.fastly.net 


192.30.253.112 github.com
192.30.253.113 github.com
192.30.253.118 gist.github.com
151.101.185.194 github.global.ssl.fastly.net
151.101.129.194 github.global.ssl.fastly.net
151.101.65.194 github.global.ssl.fastly.net
151.101.1.194 github.global.ssl.fastly.net
151.101.193.194 github.global.ssl.fastly.net
151.101.77.194 github.global.ssl.fastly.net
151.101.229.194 github.global.ssl.fastly.net
151.101.113.194 github.global.ssl.fastly.net
151.101.196.133 assets-cdn.github.com
151.101.24.133 assets-cdn.github.com
185.199.111.153 assets-cdn.github.com
185.199.110.153 assets-cdn.github.com
185.199.108.153 assets-cdn.github.com
185.199.109.153 assets-cdn.github.com
151.101.112.133 assets-cdn.github.com

151.101.112.133 avatars0.githubusercontent.com
151.101.112.133 avatars1.githubusercontent.com
151.101.184.133 avatars2.githubusercontent.com
151.101.12.133 avatars3.githubusercontent.com
151.101.12.133 avatars4.githubusercontent.com
151.101.184.133 avatars5.githubusercontent.com
151.101.184.133 avatars6.githubusercontent.com
151.101.184.133 avatars7.githubusercontent.com
151.101.12.133 avatars8.githubusercontent.com

151.101.184.133 raw.githubusercontent.com
151.101.112.133 gist.githubusercontent.com
151.101.184.133 cloud.githubusercontent.com
151.101.112.133 camo.githubusercontent.com
52.216.227.168 github-cloud.s3.amazonaws.com

192.30.253.112 github.com
185.199.108.153 assets-cdn.github.com
151.101.185.194 github.global.ssl.fastly.net
140.82.113.10 codeload.github.com

## GitHub End

raw/avatars.githubusercontent.com 无法解析

除了host外,还可以配置国内知名的dns进行解析;因为1.1.1.1不一定好使,所以就用国内的。

  • 百度DNS:180.76.76.76
  • 阿里DNS:223.5.5.5、223.6.6.6
  • 腾讯DNS:119.29.29.29、182.254.116.116

NET::ERR_CERT_AUTHORITY_INVALID

浏览器会额外提示:攻击者可能试图从 xxx.github.io 窃取你的信息,此服务器无法证明它是 xxx.github.io;你的计算机的操作系统不信任它的安全证书。这可能是由配置错误或者有攻击者截获你的连接而导致的。当继续访问时又会403。

解招!:更改为如上提供的百度、阿里、腾讯DNS,再用ipconfig/flushdns 刷新缓存。原因简述:ISP提供的DNS发送错误的根证书,换成能向访问网站提供正确证书的第三方DNS。

Github 下载过慢处理(releases)

关于releases,它可以是压缩包如zip、7z等格式;也可以是软体程式,比方说:exe、msi

  1. 打开www.ipaddress.com,查询以下链接的DNS解析地址

    github.com 
    assets-cdn.github.com 
    github.global.ssl.fastly.net
    
    # 下载链接 raw.githubusercontent.com 的实际地址
    codeload.github.com 
    
  2. 记录下查询到的IP地址,并添加进入C:\Windows\System32\drivers\etc\Hosts文件

  3. 添加 aws host

219.76.4.4 s3.amazonaws.com
219.76.4.4 github-cloud.s3.amazonaws.com
  1. 运行cmd输入ipconfig /flushdns 指令刷新系统DNS

tip

chrome 扩展 GitHub加速 + IDM/FDM 🤣

我们也可利用jsDelivr CDN加速进行下载文件,也可借此搭建访问速度加快的图床;还有站点加速下载也可试试:

Git Clone 克隆过慢改进

浅克隆

git clone 默认会下载项目的完整历史版本,若只关心最新的代码,而不关心之前的历史,可以使用浅复制功能:

$ git clone --depth=1  https://github.com/你的用户名/你的repo.git

--depth=1 表示只下载最近一次的版本,使用浅复制可以大大减少下载的数据量,这样即使在红色网络环境下,也可以快速的获得代码;若之后想获取完整历史信息,可以使用指令 $ git fetch --unshallow

git ssh方面: https://github.zhlh6.cn/ 加快速度。

代理方案

git

# 代理设置
git config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
# 取消代理
git config --global --unset https.proxy 'socks5://127.0.0.1:1080'
git config --global --unset http.proxy 'socks5://127.0.0.1:1080'

mac


# mac 终端

export http_proxy="socks5://127.0.0.1:1080"
export https_proxy="socks5://127.0.0.1:1080"

## 在 .bashrc 或 .zshrc 中设置
alias setproxy="export ALL_PROXY=socks5://127.0.0.1:1080"
alias unsetproxy="unset ALL_PROXY"

openssh


# github ssh 配置
## https://help.github.com/articles/using-ssh-over-the-https-port/

# HTTP 代理
ProxyCommand socat - PROXY:127.0.0.1:%h:%p,proxyport=8848

# socks5 代理
 ProxyCommand nc -v -x 127.0.0.1:1080 %h %p

反向代理加速 —— Static CDN,用来加载图片、内容等:

  • raw.githubusercontent.com 替换raw.staticdn.net

sum

下载无非三个问题:

  • 镜像源
  • 代理&VPN,以及hosts
  • 包、库文件的互相对应的版本

python 下载加速

由于部分项目需用到python,因附pip下载加速;pip install 想要安装文件 -i 镜像源地址 指令格式,以镜像源安装。

例:安装jupyter pip install jupyter - i http://mirrors.aliyun.com/pypi/simple/

国内常用pip源:

设定默认值,一劳永逸

pip install pip -U
pip config set global.index-url https://pypi.douban.com/simple/