degit README

The project's README from github.com/Rich-Harris/degit. As one markdown file: README.md.

degit — straightforward project scaffolding

Known Vulnerabilities install size npm package version Contributor Covenant PRs Welcome

degit makes copies of git repositories. When you run degit some-user/some-repo, it finds the latest commit on https://github.com/some-user/some-repo and downloads the associated tar file to the platform-appropriate cache directory if it doesn't already exist locally. (This is much quicker than using git clone, because you're not downloading the entire git history.)

degit resolves refs through an internal git backend, downloads tar snapshots by default, and falls back to SSH cloning when tarball fetches or extraction fail. Public HTTPS sources do not need a local git binary on your PATH, but SSH/private repositories still do.

Requirements

Installation

npm install -g degit

Quick start

Download the default branch of a GitHub repo to the current directory:

degit user/repo

Download to a new folder:

degit user/repo my-new-project
degit -r user/repo

Download only specific files:

degit user/repo my-project --files README.md,src/index.ts

Use a specific tag, branch, or commit:

degit user/repo#v1.0.0

For the full CLI reference, ESM API, and degit.json actions, see docs/USAGE.md.

Why not just git clone --depth 1?

Agent skill

Install the reusable degit skill for agents that support SKILL.md files:

# project-level install
npx skills add Rich-Harris/degit --skill degit

# global install
npx skills add Rich-Harris/degit --skill degit -g

Then ask the agent to download a repository or template. The skill helps it choose a source, ref, and destination; handle private repositories and aliases; and avoid overwriting a non-empty destination without confirmation.

See skills/degit/SKILL.md for the full skill instructions.

Documentation

See also

License

MIT

degit (Rich-Harris/degit)

Searching Database…

7.9K ·GitHub
这是什么?degit 是一个命令行工具,用来复制 git 仓库。运行 degit some-user/some-repo,它会把最新一次提交的 tar 文件下载到当前目录——不带任何 git 历史,因此用它从模板搭建项目比 git clone 快得多。
为什么不直接用 git clone --depth 1?它会跳过历史记录,下载更快,不会留下 .git 文件夹,还会把 tar 归档缓存下来供离线复用,而且输入更少。此外,通过 degit.json 可以组合出克隆后的各种操作,还内置了子目录、文件过滤和别名支持。
怎么使用?运行 degit user/repo 可以把仓库的默认分支下载到当前目录,也可以再加一个参数,把副本放到一个新文件夹里。你还可以指定具体的 tag、分支或提交作为来源。
运行它需要安装什么?需要 Node.js 20 或更高版本。公开的 HTTPS 源不需要本地安装 git,但 SSH 和私有仓库仍然要求 PATH 里有 git——而且如果 tar 包下载或解压失败,degit 会退回到用 SSH 克隆。
下载下来的副本放在哪里?tar 快照会保存到适合当前平台的缓存目录,如果本地已经存在就直接复用,所以再次下载同一个模板时不会重新从网络获取。
degit.json 能做什么?它用来定义复制完成后可以组合执行的操作。全部操作类型、完整的 CLI 参考以及 ESM API 都写在 docs/USAGE.md 里。
如果目标文件夹里已经有文件会怎样?README 没有说明 CLI 在这种情况下的具体行为,但自带的 agent 技能明确要求:未经确认不得覆盖非空的目标目录。
有类似的工具值得了解吗?README 的 see-also 部分列出了几个相关项目:Vu Tran 的 zel、Luke Edwards 的 gittar,以及 Neeraj Dalal 的 gitpick。
Size
1 MB
Stars
7.9K
Age
9y
Commits · 90 Days