Live streamJoin us for "State of code review 2024" on July 18thRegister today

How to clone a GitHub repository

Kenny DuMez
Kenny DuMez
Graphite software engineer


This guide explains this concept in vanilla Git. For Graphite documentation, see our CLI docs.

This guide provides step-by-step instructions for cloning a Git repository hosted on GitHub.

Cloning a Git repository involves copying all the files, history, and branches from a remote repository hosted on GitHub to your local machine. This is often the first step in contributing to a project or starting a new project based on an existing repository.

First, navigate to the GitHub page of the repository you want to clone. You can use the search bar on GitHub to find the repository by name or browse through GitHub profiles to find a specific project.

Once you're on the repository page, locate the "Code" button. This button will reveal a dropdown menu containing the URL of the repository. You can choose to copy the URL using HTTPS or SSH, depending on your setup:

  • HTTPS: Suitable for most users, especially if you haven't set up SSH keys on your GitHub account.
  • SSH: Best for users who have set up SSH keys for secure, password-less authentication.

Open a terminal on your local machine and run the following command:

git clone <repository_url>

Replace <repository_url> with the URL you copied from GitHub. For example:

git clone

After the cloning process completes, a new directory will be created on your local machine with the same name as the repository. Navigate into this directory to start working with the files:

cd repo

Run the following command to check the status and ensure everything is synchronized:

git status
  • Permission denied: Ensure you have the correct access rights to the repository, and if you're using SSH, check that your SSH keys are properly set up.

  • Slow cloning: Large repositories can take time to clone due to their size. If the repository contains large files or a long history, consider using a shallow clone to speed up the process:

    git clone --depth 1 <repository_url>

    This command clones only the latest commit, significantly reducing the amount of data transferred.

  • Firewall or network issues: Some corporate or school networks block access to Git operations. Ensure that ports 22 (SSH) and 443 (HTTPS) are open.

For further information on cloning GitHub repositories, see the official GitHub documentation.

Stay unblocked. Ship faster.
Experience the new developer workflow - create, review, and merge code continuously. Get started with one command.
Get started

Give your PR workflow
an upgrade today

Stack easier | Ship smaller | Review quicker

Or install our CLI.
Product Screenshot 1
Product Screenshot 2