Skip to content

0xyushy/gitsnip

Repository files navigation

gitsnip

Download any file, folder, or entire repo from GitHub—without git.

npm version MIT License


🚀 Quick Start

You do not need git or GitHub CLI—just Node.js 18+ and npx.

Clone a full repo (no .git folder):

npx gitsnip@latest owner/repo
npx gitsnip@latest https://github.com/owner/repo

Download a folder:

npx gitsnip@latest owner/repo/tree/main/path/to/folder
npx gitsnip@latest https://github.com/owner/repo/tree/main/path/to/folder

Download a file:

npx gitsnip@latest owner/repo/blob/main/path/to/file
npx gitsnip@latest https://github.com/owner/repo/blob/main/path/to/file

Specify branch or commit SHA:

npx gitsnip@latest owner/repo -b dev
npx gitsnip@latest owner/repo -b 1234abcd

Download from private repos (with token):

npx gitsnip@latest owner/repo --token <your_github_token>

🔥 Examples

# Download a public repo as a folder (no .git)
npx gitsnip@latest vercel/next.js

# Download a folder only
npx gitsnip@latest vercel/next.js/tree/canary/packages/next

# Download a single file
npx gitsnip@latest vercel/next.js/blob/canary/packages/next/package.json

# Use a GitHub token for a private repo
npx gitsnip@latest owner/private-repo --token ghp_xxxxxxx

# Specify output directory
npx gitsnip@latest vercel/next.js -o my-folder

🛠️ Options

Option Shorthand Description
-o, --out Output directory (default: .)
-b, --branch Branch or commit SHA (default: main)
-t, --token GitHub token for private repos
--force Overwrite existing files without prompting

✨ Features

  • Download any public or private file, folder, or repo from GitHub
  • Supports branches and commit SHAs
  • No git history—just files and folders
  • Works without git or GitHub CLI
  • Handles most GitHub URLs and short forms
  • Overwrite prompt for existing files (--force skips prompt)

⚡️ To-Do

  • Support downloading symlinks
  • Support cloning submodules (optionally)
  • Add archive (zip/tar) output option

📄 License

MIT


Enjoy using gitsnip? Star this repo!

About

Download any file, folder, or whole repo from GitHub—without git.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •