git clone — Cloning a Remote Repository
How to clone remote Git repositories: HTTPS vs SSH cloning, shallow clones (--depth 1), branch targeting (-b), and directory naming.
git clone — Cloning a Remote Repository
The git clone command copies an existing remote Git repository (from GitHub, GitLab, or a self-hosted server) onto your local machine, creating a new directory with the complete historical commit graph and remote tracking branches.
1. HTTPS vs. SSH Cloning
# HTTPS (Requires Personal Access Token or GitHub CLI credential helper):
git clone https://github.com/iamtashanto/OpenDevDocs.git
# SSH (Recommended: uses cryptographic SSH key without password prompts):
git clone git@github.com:iamtashanto/OpenDevDocs.git2. Cloning into a Custom Folder Name
By default, Git creates a folder matching the repository name. You can specify a custom destination directory name as the second argument:
git clone git@github.com:iamtashanto/OpenDevDocs.git my-custom-folder3. High-Performance Clone Options
1. Shallow Clone (--depth 1)
For large repositories with gigabytes of commit history where you only need the latest state (e.g. in CI/CD build runners or quick testing):
git clone --depth 1 git@github.com:iamtashanto/OpenDevDocs.git2. Single Branch Clone (-b)
git clone -b feature-darkmode --single-branch git@github.com:iamtashanto/OpenDevDocs.gitRelated Topics
git init — Initializing a New Repository
How to initialize a brand new Git repository: creating the .git directory, specifying initial branch names, and best practices.
git status — Checking Working Tree State
Mastering git status: tracked vs untracked files, staged vs unstaged modifications, short format (-s), and branch sync status.