Your repository on GitHub · lesson 5 of 9
Commands and ideas in this lesson
ARemoteanother copy, by name
Bgit clonecopy a whole repository
Corigin/mainwhere origin's main was, last you looked
Dgit remote -vlist remotes

Remotes and cloning

Last updated

So far Kusina has lived in one folder on Ana's computer. To work with Joaquin, there needs to be a copy they can both reach. In this lesson you'll meet remotes (other copies of a repository that yours knows about), clone one, and read origin/main, a label that shows where the other copy was when you last looked.

By the end of this lesson you can

  • Explain a remote as another copy of the repository, with a name and an address
  • Copy a repository with git clone
  • Explain remote-tracking branches such as origin/main, and when they change

Every copy is a whole repository

Git is distributed: every copy of a repository is complete. Ana's kusina has every commit; when Joaquin copies it, his has every commit too. Neither needs the other to read history, commit, or branch.

To work together, they need a copy they can both reach, usually on a hosting site such as GitHub, GitLab or Codeberg. The repositories you made in lessons 4.2 to 4.4 are such copies: Git repositories like Ana's, just without a working folder, on computers that are always on.

Remotes and origin

A remote is another copy of the repository that yours knows about: a short name for a long address.

  • git remote -v lists them, each with the address for fetching and for pushing (usually the same).
  • When you clone, Git names the copy you cloned from origin. It's only a name; it could be anything, but everyone uses origin.
  • git remote add <name> <address> adds one (lessons 4.8 and 5.5).

Addresses look like https://github.com/ana/kusina.git or [email protected]:ana/kusina.git (the second is SSH, lesson 4.8). The sandbox's pretend host is https://example.com/ana/kusina.git.

Clone Kusina

On GitHub, the address is under the green Code button:

Screenshot of the Code button’s menu on the same repository, with numbered callouts. The numbered list below describes each part.
  1. HTTPS and GitHub CLI. Two kinds of address. HTTPS works everywhere; the SSH address appears here too once you’ve added an SSH key (lesson 4.8). GitHub CLI shows a gh repo clone command instead.
  2. Address and copy button. The address to give git clone, ending in .git. The button copies it.
  3. Open in an app. Clone with GitHub Desktop, or open in GitHub’s Copilot app. Both run Git underneath; this course uses the terminal so it works the same everywhere.
  4. Download ZIP. Only the files, as they are now. No history and no Git: changes made to a ZIP can’t be pulled, committed or pushed.
The Code button’s menu on a GitHub repository. Screenshot of github.com, captured on 5 December 2026, signed out. GitHub changes its pages often, so yours may look a little different; the names in the list stay the same.

git clone <address> [folder] makes a new folder, copies every commit into it, names the source origin, and checks out main. Clone is how Joaquin gets Kusina on his computer, and how you'll get any project you contribute to.

Git sandbox
  1. See Kusina’s remote with git remote -v
  2. Go up to your home folder, and clone Kusina into a folder called kusina-laptop
  3. Go into it and check that it has origin too
  4. See its whole history with git log --oneline

Working folder

no changes

Staging area

nothing staged

Repository

10 commits on main

Remote

origin: example.com/ana/kusina.git · in step, as of your last fetch

You are in ~/kusina. It is connected to a hosted copy, origin, and Joaquin has his own clone on his computer.

Your folders

  • /home/ana
    • kusina/(repository)◀ you are here
      • README.md
      • adobo.md
      • build_index.py
      • leche-flan.md
      • lumpia.md
      • pancit.md
      • sinigang.md

The new folder has every commit and every file. It's a full repository in its own right.

origin/main

After cloning, your graph shows two labels on the newest commit: main and origin/main.

  • main is your branch. It moves when you commit.
  • origin/main is a remote-tracking branch: Git's note of where origin's main was the last time you talked to origin. You can't commit on it. It only moves when you git fetch, git pull or git push.
$ git log --oneline --all -2
67e435d (HEAD -> main, origin/main) Cover the leche flan with foil
ba04ca2 Add lumpiang shanghai recipe
  1. 67e435d HEAD →mainorigin/main Cover the leche flan with foil
  2. ba04ca2 Add lumpiang shanghai recipe
  3. 98a5edc Add a script that builds the index page
  4. d078487 Make the sinigang steps clearer
  5. 145dc1e Add pancit bihon recipe
  6. 52d1f4d Say how much salt goes in the adobo
  7. 1c17fad Add a README
  8. 9c53888 Add leche flan recipe
  9. 1f359a2 Add sinigang recipe
  10. 601c654 Add adobo recipe
1 of 3 main and origin/main are on the same commit: Ana and the hosted copy agree.

git branch -a lists remote-tracking branches too, as remotes/origin/main.

Spot the trap: "origin/main is up to date"

Spot the trapAna

Ana runs git status: “Your branch is up to date with ‘origin/main’.” She tells Joaquin she has all his work.

What happens if…

Check what you learned

What is origin?
Joaquin pushed a commit a minute ago. When does Ana’s origin/main move to it?
After git clone, how much of Kusina’s history does the new folder have?

Sources

Every command on this page behaves as these pages describe, and the sandbox prints what Git 2.55 prints. Hosting features (pull requests, protected branches) come from the host’s own documentation.

All sources for Simple Git