Loading lessons...
Clone from GitHub
Clone from GitHub
Cloning copies a repository from GitHub down to your computer so you can work on it locally.
The clone command
git clone https://github.com/user/repo.git
This downloads the project and its complete history into a folder named after the repository.
What you get
A clone includes:
- All the files.
- The full commit history.
- The origin remote, already set up.
Clone into a specific folder
git clone https://github.com/user/repo.git my-project
The last argument sets the destination folder name.
Clone a specific branch
git clone -b dev https://github.com/user/repo.git
The -b flag checks out the given branch instead of the default one.
SSH clone
git clone git@github.com:user/repo.git
This uses SSH instead of HTTPS, which works if you set up an SSH key.
TL;DR
git clone URLcopies a remote repository locally.- You get all files, full history, and origin set up.
-b branchclones a specific branch.- SSH URLs use your SSH key for authentication.