SyntaxStudy
Sign Up
Home Git Reference git clone

git clone

command

Creates a local copy of a remote repository including all commits, branches, and history.

Syntax

git clone <url> [directory]

Example

bash
git clone https://github.com/user/repo.git
git clone https://github.com/user/repo.git my-folder

# Clone specific branch
git clone -b main https://github.com/user/repo.git

# Shallow clone (faster, last commit only)
git clone --depth 1 https://github.com/user/repo.git