LinuxCommandLibrary

dolt-clone

Clone a Dolt database repository

TLDR

Clone an existing repository into a specific directory (defaults to the repository name)

$ dolt clone [repository_url] [path/to/directory]
copy

Clone an existing repository and add a specific remote (defaults to origin)
$ dolt clone --remote [remote_name] [repository_url]
copy

Clone an existing repository only fetching a specific branch (defaults to all branches)
$ dolt clone [[-b|--branch]] [branch_name] [repository_url]
copy

Clone a repository, using an AWS region (uses the profile's default region if none is provided)
$ dolt clone --aws-region [region_name] [repository_url]
copy

Clone a repository, using an AWS credentials file
$ dolt clone --aws-creds-file [credentials_file] [repository_url]
copy

Clone a repository, using an AWS credentials profile (uses the default profile if none is provided)
$ dolt clone --aws-creds-profile [profile_name] [repository_url]
copy

Clone a repository, using an AWS credentials type
$ dolt clone --aws-creds-type [credentials_type] [repository_url]
copy

SYNOPSIS

dolt clone [<options>] <repository_url> [<destination_path>]

PARAMETERS

<repository_url>
    The URL of the remote Dolt repository to clone. This can be a DoltHub URL (e.g., dolthub/organization/repository), an HTTP(S) URL, or an SSH URL.

[<destination_path>]
    An optional path to the directory where the cloned repository will be placed. If omitted, the repository will be cloned into a new directory named after the repository component of the URL.

--branch <branch_name>
    Check out <branch_name> instead of the remote's default branch after cloning the repository.

--config <key>=<value>
    Set a configuration variable in the newly created repository's local configuration.

--depth <depth>
    Create a shallow clone with a history truncated to the specified number of commits from the head of the chosen branch.

--no-checkout
    Clone the repository but do not check out a working tree. This leaves the working directory empty, containing only the .dolt directory.

--bare
    Create a bare Dolt repository. A bare repository does not have a working directory for SQL operations but contains only the .dolt directory, suitable for serving as a remote.

--origin <name>
    Assign the name <name> to the remote tracking the cloned repository instead of the default origin.

DESCRIPTION

dolt-clone is a core command within the Dolt database system, which uniquely combines a SQL database with Git-like version control features. It functions analogously to git clone, allowing users to create a local copy of a remote Dolt repository. When dolt-clone is executed, it fetches all the commits and their associated database states from the specified remote URL and checks out the default branch (typically main or master) into a new directory. This directory becomes a fully functional local Dolt repository, enabling users to interact with the database, make changes, commit them, and push/pull from remotes, just like with Git. It is the primary way to begin working with an existing Dolt database hosted remotely, for instance, on DoltHub or a self-hosted Dolt server. The cloned directory will contain the Dolt internal data files (the .dolt directory) and a working SQL database instance ready for interaction.

CAVEATS

Large Repositories: Cloning very large Dolt repositories, especially those with extensive history or massive datasets, can be time-consuming and resource-intensive, requiring significant network bandwidth and disk I/O.

Authentication: Accessing private Dolt repositories requires proper authentication, typically via SSH keys configured on the system or through dolt login for DoltHub credentials.

Disk Space: A full clone requires disk space equivalent to the entire historical data of the database, as all past commits and their states are downloaded.

Network Dependency: The performance and success of the clone operation are highly dependent on network speed, latency, and the responsiveness of the remote Dolt server.

SUPPORTED PROTOCOLS

dolt-clone supports various protocols for accessing remote repositories, including the native dolt protocol (often used for DoltHub and self-hosted Dolt servers), standard HTTP(S), and SSH. The protocol used typically determines the format of the <repository_url>.

DEFAULT BRANCH AND WORKING DIRECTORY

By default, upon successful cloning, dolt-clone checks out the remote's default branch (commonly main or master) into a new directory. This directory, named after the repository (or the specified <destination_path>), becomes the working directory containing both the .dolt internal data directory and the current state of the database.

HISTORY

Dolt, developed by Liquidata (now DoltHub), was publicly launched in 2019 with the vision of applying Git-like version control to SQL databases. From its inception, dolt-clone has been a fundamental command, mirroring the indispensable role of git clone in the Git ecosystem. It was designed to provide users with an intuitive and familiar way to acquire and begin interacting with existing Dolt databases, thereby facilitating collaboration and the distribution of versioned data. Its command-line interface and option set were consciously designed to parallel git clone, ensuring a smooth transition and familiar experience for developers already proficient with Git workflows.

SEE ALSO

dolt init(1), dolt remote(1), dolt pull(1), dolt push(1), git clone(1)

Copied to clipboard