Skip to main content

Overview

cloneit is designed to download specific GitHub directories or files without cloning the entire repository. This page covers the fundamental usage patterns to get you started.

Command Syntax

The basic syntax for cloneit is:
cloneit [OPTIONS] <url>...

Arguments

  • <url>... - URL to the GitHub directory or file (required)
  • You can pass a single URL or multiple comma-delimited URLs

Options

  • -h, --help - Print help information
  • -V, --version - Print version information
  • -z, --zip - Download and zip the directory or file
  • -q, --quiet - Disable verbose logging

Basic Workflow

When you run cloneit, it follows these steps:
  1. Validates the URL - Ensures the GitHub URL is properly formatted
  2. Downloads content - Fetches the file or directory from GitHub
  3. Creates structure - Preserves the directory structure locally
  4. Zips (optional) - If -z flag is used, creates a zip archive
cloneit uses the GitHub API to fetch content, which means you can download specific parts of a repository without cloning everything.

Common Use Cases

Download a Repository

Download an entire repository:
cloneit https://github.com/alok8bb/cloneit
This downloads the repository into a cloneit directory in your current location.

Download a Subdirectory

Download only a specific folder from a repository:
cloneit https://github.com/alok8bb/cloneit/tree/master/src
This downloads only the src directory, preserving its structure.

Download a Single File

Download an individual file:
cloneit https://github.com/alok8bb/cloneit/tree/master/src/main.rs
The file will be downloaded to your current directory.

Output and Logging

By default, cloneit provides verbose output showing:
  • Progress indicator (e.g., [1/3])
  • Current step (validating, downloading, etc.)
  • Individual files being downloaded (marked with +)
  • Success confirmation

Quiet Mode

To suppress informational output and only show warnings:
cloneit -q https://github.com/alok8bb/cloneit
Quiet mode is useful when using cloneit in scripts or automation where you only want to see errors.

GitHub API Authentication

For higher rate limits and access to private repositories, you can provide a GitHub token:
export GITHUB_TOKEN=your_github_token_here
cloneit https://github.com/username/private-repo
Without authentication, you’re limited to 60 requests per hour by GitHub’s API rate limiting.

Directory Structure

When downloading directories, cloneit:
  • Creates a root directory named after the repository or target folder
  • Preserves the complete nested directory structure
  • Downloads all files recursively
  • Maintains file names and extensions

Next Steps

Build docs developers (and LLMs) love