Create & Clone Repositories in Git

From the Git cheat sheet · Getting Started · verified Jul 2026

Create & Clone Repositories

Start a new project or get an existing one

bash
# Create new repository
git init
git init <directory>

# Clone existing repository
git clone <url>
git clone <url> <directory>

# Clone specific branch
git clone -b <branch> <url>
💡 Clone creates a full copy with history
⚡ Use shallow clone for faster downloads
📌 Init creates a new .git directory

More Git tasks

Back to the full Git cheat sheet