Lesson 03 — Cloning a Repository
Copy an existing GitHub repository to your computer.
What cloning means
Section titled “What cloning means”To clone a repository means to download a full working copy of it from GitHub to your computer.
After cloning, you have:
- The project files
- The Git history
- A connection back to the GitHub repository
Checklist
Section titled “Checklist”1. Find the repository on GitHub
Section titled “1. Find the repository on GitHub”- Open the repository page in GitHub.
- Click the green Code button.
- Copy the HTTPS URL.
It will look like:
https://github.com/organization/repository-name.git2. Choose where to put the project
Section titled “2. Choose where to put the project”In your terminal, move to a folder where you keep projects.
Example:
cd Documents3. Clone the repository
Section titled “3. Clone the repository”Run:
git clone https://github.com/organization/repository-name.gitReplace the URL with the actual repository URL.
- The repository downloaded successfully.
4. Move into the repository folder
Section titled “4. Move into the repository folder”Run:
cd repository-name- I am now inside the repository folder.
5. Check status
Section titled “5. Check status”Run:
git status- Git says I am on a branch, usually
main. - Git says my working tree is clean.
Practice task
Section titled “Practice task”Clone a practice repository, enter the folder, and run:
git statusgit remote -vgit remote -v shows the GitHub address connected to your local copy.
Completion check
Section titled “Completion check”- I can clone a repository.
- I can move into the repository folder.
- I can run
git statusinside the repository. - I can run
git remote -vto see the GitHub connection.