
rich-harris/degit
Developer toolsЭта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал
Простая конструкция проекта
Обзор
Делает копии git-репозиториев. При запуске degit some-user/some-repo он находит последний коммит на https://github.com/some-user/some-repo и скачает соответствующий tar-файл в платформенную директорию кэша, если он ещё не существует локально. На Linux/BSD это следует XDG_CACHE_HOME при установке и использует ~/.cache/degit; на macOS — ~/Library/Caches/degit; в Windows — %LOCALAPPDATA%\degit. (Это гораздо быстрее, чем с git clone, потому что вы не скачиваете всю историю git.) Degit разрешает ссылки через внутренний git бэкенд, по умолчанию скачает снимки tar и возвращается к клонированию SSH при неудаче с tarball или извлечением. Публичным HTTPS-источникам не нужен локальный git бинар на вашем PATH, но SSH/приватные репозитории всё равно нужны. - Node.js или позже (см. движки в package.json) — Bun при разработке этого репозитория (см. packageManager в разделе package).
Обзор (машинный перевод)
degit создаёт копии git-репозиториев. Когда вы запускаете degit some-user/some-repo, он находит последний коммит на https://github.com/some-user/some-repo и скачивает соответствующий файл tar в платформенную директорию кэша, если он ещё не существует локально. (Это гораздо быстрее, чем использование git clone, потому что вы не скачиваете всю историю git.)
degit разрешает ссылки через внутренний git-бэкенд, по умолчанию загружает tar-снимки и возвращается к клонированию SSH, когда tarball не получает или не удаётся извлечение. Публичные HTTPS-источники не нуждаются в локальном бинарном файле [git на вашем PATH, но SSH/приватные репозитории всё равно нужны.
Требования
- Node.js 20 или позже (см.
enginesвpackage.json)
Установка
Быстрый старт
Скачайте стандартную ветку репозитория GitHub в текущую директорию:
Скачать в новую папку:
Скачивайте только конкретные файлы:
Используйте конкретный тег, ветку или коммит:
Полный справочник CLI, ESM API и действия degit.json см. docs/USAGE.md.
Почему бы просто не git clone --depth 1?
- Нет оставшейся папки
.gitиз шаблона. - Кэширует архивы асфальта для повторного использования в офлайн-режиме.
Эта страница переведена автоматически. Технические детали смотрите в оригинале.
README
Показан фрагмент оригинального README. Открыть оригинал.
degit — straightforward project scaffolding
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
- Node.js 20 or later (see
enginesinpackage.json)
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?
- No leftover
.gitfolder from the template. - Caches tar archives for offline reuse.
- Less to type (
degit user/repoversusgit clone --depth 1 ...). - Composable post-clone actions via
degit.json. - Built-in support for subdirectories, file filtering, and aliases.
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
- docs/USAGE.md — full CLI reference, ESM API, and
degit.jsonactions - docs/CONTRIBUTING.md — contributing, development setup, and CI checks
- docs/SECURITY.md — security policy and reporting process
Рекомендуемые инструменты
Попробуйте другой запрос или уберите фильтр.
Установка
npx skillfish add rich-harris/degit