惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

W
WeLiveSecurity
博客园 - 【当耐特】
Microsoft Azure Blog
Microsoft Azure Blog
WordPress大学
WordPress大学
Stack Overflow Blog
Stack Overflow Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
IT之家
IT之家
Cloudbric
Cloudbric
The Register - Security
The Register - Security
小众软件
小众软件
PCI Perspectives
PCI Perspectives
G
Google Developers Blog
AI
AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Google DeepMind News
Google DeepMind News
Google DeepMind News
Google DeepMind News
宝玉的分享
宝玉的分享
Recent Commits to openclaw:main
Recent Commits to openclaw:main
量子位
TaoSecurity Blog
TaoSecurity Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
F
Full Disclosure
N
Netflix TechBlog - Medium
博客园_首页
Last Week in AI
Last Week in AI
A
Arctic Wolf
B
Blog RSS Feed
J
Java Code Geeks
C
Cybersecurity and Infrastructure Security Agency CISA
I
InfoQ
aimingoo的专栏
aimingoo的专栏
云风的 BLOG
云风的 BLOG
NISL@THU
NISL@THU
MyScale Blog
MyScale Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Jina AI
Jina AI
有赞技术团队
有赞技术团队
S
Schneier on Security
L
Lohrmann on Cybersecurity
P
Privacy & Cybersecurity Law Blog
T
Threat Research - Cisco Blogs
P
Palo Alto Networks Blog
S
Security @ Cisco Blogs
Security Archives - TechRepublic
Security Archives - TechRepublic
Security Latest
Security Latest
Vercel News
Vercel News
博客园 - 司徒正美
Webroot Blog
Webroot Blog
Hacker News: Ask HN
Hacker News: Ask HN
A
About on SuperTechFans

Inno' Blog

将 what-digit-you-write 部署到 Heroku上 | Inno' Blog 论文浅析:GpSense: A GPU-friendy method for common-sense subgraph matching in massively parallel architectures Hadoop分布式搭建全流程记录 | Inno' Blog Shell编程学习记录 | Inno' Blog 重学MySQL之视图 | Inno' Blog 重学MySQL之查询练习 | Inno' Blog 重学MySQL之事务 | Inno' Blog 重学MySQL之范式 | Inno' Blog 重学MySQL之基本操作和约束 | Inno' Blog 为你的Web应用提供HTTPS服务 | Inno' Blog 一个关于切片的小问题 | Inno' Blog Go语言学习笔记 | Inno' Blog 关于英译中的个人技巧 | Inno' Blog 不知不觉已经写够了十万行代码 | Inno' Blog YARN 架构 | Inno' Blog HDFS 架构 | Inno' Blog 正则中关于环视(lookaround)的小例子 | Inno' Blog 设计模式(十八):访问者模式 | Inno' Blog 如何借助Github进行协同开发 | Inno' Blog
Github项目clone速度过慢?试试这招 | Inno' Blog
Inno Fang · 2020-08-28 · via Inno' Blog

errrr,这标题有内味了……

将要 clone 的 Github 项目链接稍微修改一下就可以了,比如:

git clone https://github.com/username/repo.git

修改为

git clone https://github.com.cnpmjs.org/username/repo.git

就是多了一个 cnpmjs.org。其实 https://github.com.cnpmjs.org 就是一个 Github 的镜像网站,同样也是可以打开的。对于经常用 node.js 的人来说,看到 cnpm 应该也挺熟悉的。

这个方法用了挺久的了,不过最近发现还是有很多人将项目同步到 Gitee 后再下载,相比之下只用加几个字母就可以让 clone 的速度有极大的提高,我觉得这种方法倒是值得推广一下的。 😀

此外,有的项目其实本身体积并不大,可能也就几 M 大小,但是 clone 后查看项目代码的体积却有几百 M。其实对于一个经常更新的项目来说,几百甚至上千的 commits 也是挺常见的,这就导致有时候真正占据 clone 时长的就是 .git 文件,而非项目的主要代码。对于大部分需要 clone 项目的人来说,更关心的只是项目的最新修改而非之前的修改,所以通过设定 clone 的深度 (--depth) 可以在减少 clone 项目体积的同时也减少了 clone 的时间。在克隆时指定 --depth 1--depth 后面的数字表示要克隆最近的历史版本数,为 1 代表只克隆最新的一个版本。

搭配镜像网站链接使用更佳

1
git clone --depth 1 https://github.com.cnpmjs.org/username/repo.git

Copyright Notice: All articles in this blog are licensed under CC BY-NC-ND 4.0 unless stating additionally.