🌱 BasicsCommonly used
How to clone a Git repository
Download a remote repository to your local machine.
Clone via HTTPS
git clone https://github.com/user/repo.gitDownloads the repository using HTTPS. You will be prompted for credentials when pushing.
When to use: Quick cloning without SSH setup. Easier for beginners.
Clone via SSH
git clone git@github.com:user/repo.gitDownloads the repository using SSH. Requires SSH key setup but no password prompts.
When to use: Recommended for daily use — no password prompts when pushing.
Clone into a specific folder
git clone https://github.com/user/repo.git my-folderClones the repository into a folder named "my-folder" instead of the repo name.
Clone a specific branch
git clone -b develop https://github.com/user/repo.gitClones the repository and checks out the "develop" branch immediately.
Shallow clone (faster)
git clone --depth 1 https://github.com/user/repo.gitClones only the latest commit, not the full history. Faster for large repos.
When to use: CI/CD pipelines or when you only need the latest code, not the full history.