Read Anthropic’s case study about Graphite Reviewer

How to clone a GitHub repository

Kenny DuMez
Kenny DuMez
Graphite software engineer


Note

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:

Terminal
git clone <repository_url>

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

Terminal
git clone https://github.com/user/repo.git

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:

Terminal
cd repo

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

Terminal
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:

    Terminal
    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.

Git inspired
Graphite's CLI and VS Code extension make working with Git effortless.
Learn more

Graphite
Git stacked on GitHub

Stacked pull requests are easier to read, easier to write, and easier to manage.
Teams that stack ship better software, faster.

Or install our CLI.
Product Screenshot 1
Product Screenshot 2