Skip to main content

Quick Introduction

This guide will walk you through the most common cloneit operations. By the end, you’ll know how to download files, directories, and create zipped archives from GitHub repositories.

Basic Usage

The basic syntax for cloneit is:
cloneit [OPTIONS] <url>...
Where <url> is a GitHub URL pointing to a repository, directory, or file.

Common Operations

1

Download a Single File

To download a specific file from a GitHub repository:
cloneit https://github.com/alok8bb/cloneit/tree/master/src/main.rs
This downloads just the main.rs file to your current directory.
The file will be saved with its original name in the current working directory.
2

Download a Directory

To download an entire directory from a repository:
cloneit https://github.com/alok8bb/cloneit/tree/master/src
This downloads the entire src directory with all its contents, preserving the folder structure.You can also download the entire repository:
cloneit https://github.com/alok8bb/cloneit
3

Download and Zip

Use the -z flag to automatically zip the downloaded content:
cloneit -z https://github.com/alok8bb/cloneit
This downloads the repository and creates a cloneit.zip file containing all the contents.
The zip feature was contributed by @winterrdog.
4

Download Multiple Resources

Download multiple files or directories in a single command using comma-delimited URLs:
cloneit https://github.com/alok8bb/cloneit/tree/master/src,https://github.com/alok8bb/cloneit/tree/master/Cargo.toml
Do not include spaces after the commas when specifying multiple URLs.

Command Options

url
string
required
GitHub URL(s) to download. Accepts:
  • Repository URLs: https://github.com/user/repo
  • Directory URLs: https://github.com/user/repo/tree/branch/path
  • File URLs: https://github.com/user/repo/blob/branch/path/file.ext
Multiple URLs can be comma-separated (no spaces).
-z, --zip
flag
Download and automatically zip the directory or file.
-q, --quiet
flag
Disable verbose logging and only show warnings.
-h, --help
flag
Print help information.
-V, --version
flag
Print version information.

Real-World Examples

cloneit https://github.com/user/dotfiles/tree/main/.vimrc

What Happens During Download?

When you run a cloneit command, the tool:
  1. Validates the URL - Ensures it’s a valid GitHub URL
  2. Downloads content - Fetches the specified files or directories
  3. Preserves structure - Maintains the original directory hierarchy
  4. Zips if requested - Creates an archive if the -z flag is used
Downloaded files are saved to your current working directory. Make sure you’re in the correct directory before running cloneit.

Tips

  • Use the -q flag when running cloneit in scripts to reduce output
  • The -z flag is useful for archiving project snapshots
  • You can clone from any branch by using the full GitHub URL with the branch name
  • Downloaded directories maintain their original structure, making integration into projects seamless

Next Steps

Command Reference

Explore all available commands and options

Usage Guide

See more real-world usage examples

Build docs developers (and LLMs) love