Cette page est affichée en anglais. Une traduction française est en cours.
ConfigsMay 30, 2026·3 min de lecture

degit — Scaffold Projects from Git Repos Without the History

A lightweight scaffolding tool by Rich Harris that copies the latest snapshot of a git repository without cloning the full history.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
degit Overview
Commande d'installation directe
npx -y tokrepo@latest install 21a04d89-5bbe-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en dry-run.

Introduction

degit makes copies of git repositories without cloning the full history. Created by Rich Harris (the creator of Svelte), it downloads only the latest files as a tarball, making project scaffolding nearly instant. It is particularly popular in the Svelte ecosystem but works with any GitHub, GitLab, or Bitbucket repository.

What degit Does

  • Downloads the latest snapshot of a repository without any git history or .git directory
  • Supports targeting specific branches, tags, or commit hashes with the #ref syntax
  • Copies subdirectories from within a repository, not just the root
  • Runs post-clone actions defined in a degit.json file (like renaming files)
  • Caches downloaded tarballs locally so repeated scaffolding is instant

Architecture Overview

degit works by fetching the tarball archive that GitHub, GitLab, and Bitbucket expose for any ref. It does not use git clone, so there is no history transfer and no requirement for git to be installed. The downloaded archive is extracted into the target directory. If the repo has a degit.json at its root, degit runs the declared actions (like file cloning or removal) after extraction.

Self-Hosting & Configuration

  • Install via npm globally or use npx for one-off usage (npx degit user/repo)
  • No configuration required for basic usage
  • Supports private repos when authenticated via environment tokens
  • Add a degit.json to your template repo to define post-clone actions
  • Works with GitHub, GitLab, Bitbucket, and custom git hosts via URL syntax

Key Features

  • No git history in the output means a clean starting point for new projects
  • Faster than git clone because it downloads a compressed tarball instead of the full object database
  • Local caching avoids redundant downloads when scaffolding the same template repeatedly
  • Subdirectory support lets you keep multiple templates in a single monorepo
  • Post-clone actions via degit.json can rename package names, remove example files, and more

Comparison with Similar Tools

  • git clone --depth 1 — downloads the latest commit but still creates a .git directory; degit gives you clean files only
  • GitHub template repositories — requires a GitHub account and creates a new repo; degit copies files locally without any remote setup
  • create-react-app / create-svelte — framework-specific scaffolders; degit works with any repository on any platform
  • tiged — a community fork of degit with additional fixes; degit is the original with broader recognition

FAQ

Q: Does degit require git to be installed? A: No. It fetches tarballs over HTTPS, so git is not needed on the machine.

Q: Can I use degit with private repositories? A: Yes. Set a GitHub token via the environment and degit will use it to authenticate the download.

Q: What happens if I run degit in a non-empty directory? A: By default it will fail to prevent overwriting. Use --force to override this check.

Q: Is degit maintained? A: The original repo has limited recent activity. The community fork tiged is actively maintained and fully compatible.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires