Skip to content

Lesson 03 — Cloning a Repository

Copy a GitHub repository to your computer and confirm that Git can see it correctly.

To clone a repository means to download a full working copy from GitHub to your computer.

After cloning, you have:

Diagram showing git clone copying a GitHub repository into a local folder on your computer, including project files, Git history, and the origin connection back to GitHub.

  • The project files
  • The Git history
  • A connection back to the GitHub repository

For this course, learners should work in their own copy of a practice template such as git-basics-sql-practice.

Open the public SQL practice template repository:

  1. Go to BigInformatics/git-basics-sql-practice.
  2. Click Use this template.
  3. Create a new repository under your own GitHub account or training organization.
  4. Clone your new repository, not the course site.

This keeps practice work separate from the course materials.

  • Open your learner-owned practice repository in GitHub.
  • Click the green Code button.
  • Copy the HTTPS URL.

It will look like:

https://github.com/your-account/git-basics-sql-practice.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/your-account/git-basics-sql-practice.git

Replace the URL with the actual repository URL.

  • The repository downloaded successfully.

Run:

Terminal window
cd git-basics-sql-practice
  • I am now inside the repository folder.

Run:

Terminal window
git status

Expected result:

On branch main
nothing to commit, working tree clean

The wording may vary slightly. The important points are that you are on a branch and Git does not show unexpected changes.

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

Run:

Terminal window
git remote -v

You should see the GitHub URL for your learner-owned practice repository.

  • origin points to my practice repository.
  • 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.
  • I know whether I am working in my practice repository or the course site.