國內(nèi)最常用的鏡像地址:
1. github.com.cnpmjs.org
2. hub.fastgit.org (推薦)
3. gitclone.com
網(wǎng)站的內(nèi)容與GitHub完整同步,可進(jìn)行下載克隆等操作。
倉庫克隆下載
原地址
git clone https://github.com/docker/compose.git `
改為
git clone https://github.com.cnpmjs.org/docker/compose.git
或者
git clone https://hub.fastgit.org/docker/compose.git
或者
git clone https://gitclone.com/github.com/docker/compose.git
Release下載加速
原地址
wget https://github.com/golang/go/archive/go1.15.7.tar.gz
改為
wget https://hub.fastgit.org/golang/go/archive/go1.15.7.tar.gz
免替換法
git config --global url."https://hub.fastgit.org".insteadOf https://github.com
直接編輯 ~/.gitconfig 添加:
[url "https://hub.fastgit.org/"] insteadOf = https://github.com/
查看git配置信息
git config --global --list
取消設(shè)置
git config --global --unset url."https://hub.fastgit.org.insteadof"
raw文件下載加速
將 raw.githubusercontent.com 替換為 raw.staticdn.net 即可加速。
原地址
wget https://raw.githubusercontent.com/kubernetes/kubernetes/master/README.md
替換為
wget https://raw.staticdn.net/kubernetes/kubernetes/master/README.md
GitHub + Jsdelivr CDN加速
jsDelivr 是一個(gè)免費(fèi)開源的CDN 解決方案;
包含 JavaScript 庫、jQuery 插件、CSS 框架、字體等常用的靜態(tài)資源;
jsdelivr 不能獲取 exe 文件以及 Release 處附加的 exe 和 dmg 文件。
1. 直接引用(臨時(shí))
格式為:
https://cdn.jsdelivr.net/gh/<用戶名>/<倉庫名>/<文件及路徑>
例如:GitHub
https://github.com/qimage/pub/blob/main/avatar.webp
轉(zhuǎn)成 jsdelivr
https://cdn.jsdelivr.net/gh/qimage/pub/avatar.webp
github.com 替換成 cdn.jsdelivr.net/gh
/blob/main 刪除
2. 引入版本號(hào)(推薦)
版本號(hào)用@符鏈接,格式為:
https://cdn.jsdelivr.net/gh/<用戶名>/<倉庫名>@版本號(hào)/<文件及路徑>
例如:GitHub
https://github.com/qimage/pub/blob/main/avatar.webp
轉(zhuǎn)成 jsdelivr
https://cdn.jsdelivr.net/gh/qimage/pub@main/avatar.webp
github.com 替換成 cdn.jsdelivr.net/gh
/blob/ 替換成 @
注:main為創(chuàng)建的版本號(hào)
建議使用發(fā)布版本號(hào)方案,只要單次版本號(hào)下的內(nèi)容大小不超過50M即可,超過50M時(shí)使用多版本號(hào)。
技巧
需要jsDelivr緩存實(shí)時(shí)刷新,只需將想刷新的鏈接的開頭的
https://cdn.jsdelivr.net/
替換成
https://purge.jsdelivr.net/
即可實(shí)時(shí)刷新,刷新成功后,瀏覽器會(huì)返回緩存刷新成功的信息。
修改HOSTS文件進(jìn)行加速
1. 查詢相關(guān)域名IP地址
通過 ipaddress.com 查詢
2. 修改host文件映射查找到的IP地址
windows系統(tǒng)中修改C:\Windows\System32\drivers\etc\hosts文件的權(quán)限,指定可寫入;
ubuntu系統(tǒng)中修改/etc/hosts文件;
用編輯器打開hosts文件,在末尾處添加以下內(nèi)容:
199.232.69.194 github.global.ssl.fastly.net 140.82.112.4 github.com
同時(shí)也可以查詢其他域名地址,解決DNS污染問題。
可以直接選中以下內(nèi)容復(fù)制粘貼,20210126更新
3. 本地DNS刷新
windows中若遇到網(wǎng)絡(luò)異常,可能是DNS緩存的問題,可以命令刷新。
ipconfig /displaydns # 顯示dns緩存 ipconfig /flushdns # 刷新DNS記錄 ipconfig /renew # 重請從DHCP服務(wù)器獲得IP
ubuntu中重啟網(wǎng)絡(luò)
sudo /etc/init.d/networking restart
通過 Gitee 導(dǎo)入Github倉庫進(jìn)行中轉(zhuǎn)下載
訪問 gitee 并登錄,在頂部選擇“從 GitHub/GitLab 導(dǎo)入倉庫”。
導(dǎo)入后,若源站更新,Gitee導(dǎo)入倉庫需要強(qiáng)制更新同步。
Gitee 極速下載,熱門倉庫每日同步一次。
GitHub 文件加速
利用 Cloudflare Workers提供GitHub 文件 , Releases , archive 以及 raw.githubusercontent.com 文件加速下載服務(wù)。
開源項(xiàng)目地址: https://github.com/hunshcn/gh-proxy
部署獨(dú)立地址: https://ghproxy.com/