Skip to main content

Cloning Repositories

✨ This page serves as Quickstart for working with repositories. For a more comprehensive reference about Working with GitHub repositories, refer to Creating and managing repositories

Repository terminology

A repository is the most basic element of GitHub. Before getting started with repositories, learn these important terms.

TermDefinition
BranchA parallel version of your code that is contained within the repository, but does not affect the primary or main branch.
CloneTo download a full copy of a repository's data from GitHub, including all versions of every file and folder.
ForkA new repository that shares code and visibility settings with the original "upstream" repository.
MergeTo take the changes from one branch and apply them to another.
Pull requestA request to merge changes from one branch into another.
RemoteA repository stored on GitHub, not on your computer.
UpstreamThe branch on an original repository that has been forked or cloned. The corresponding branch on the cloned or forked branch is called the "downstream."

Cloning a repository

  1. On GitHub.com, navigate to the main page of the repository.
  2. Above the list of files, click Code button. Screenshot of <> Code icon
  3. Copy the URL for the repository.
    • To clone the repository using HTTPS, under HTTPS, click clipboard icon.
    • To clone the repository using an SSH key, including a certificate issued by your organization's SSH certificate authority, click SSH, then click clipboard icon.
    • To clone a repository using GitHub CLI, click GitHub CLI, then click copy icon. Screenshot of clone with html-ssh-github cli
  4. Open Git Bash.
  5. Change the current working directory to the location where you want the cloned directory.
  6. Type git clone, and then paste the URL you copied earlier.
git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
  1. Press Enter to create your local clone.
$ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY
> Cloning into `Spoon-Knife`...
> remote: Counting objects: 10, done.
> remote: Compressing objects: 100% (8/8), done.
> remove: Total 10 (delta 1), reused 10 (delta 1)
> Unpacking objects: 100% (10/10), done.

Sources

  1. About repositories
  2. Cloning a repository