Skip to content

Lesson 03 — Cloning a Repository

Copy an existing GitHub repository to your computer.

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
  • 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.git

In your terminal, move to a folder where you keep projects.

Example:

Terminal window
cd Documents

Run:

Terminal window
git clone https://github.com/organization/repository-name.git

Replace the URL with the actual repository URL.

  • The repository downloaded successfully.

Run:

Terminal window
cd repository-name
  • I am now inside the repository folder.

Run:

Terminal window
git status
  • Git says I am on a branch, usually main.
  • Git says my working tree is clean.

Clone a practice repository, enter the folder, and run:

Terminal window
git status
git remote -v

git remote -v shows the GitHub address connected to your local copy.

  • I can clone a repository.
  • I can move into the repository folder.
  • I can run git status inside the repository.
  • I can run git remote -v to see the GitHub connection.