Skip to the workspace
Pebellslearn by building
Version Control and Hosting  ›  Lesson

Remotes and GitHub — Push, Fetch, Pull

GitHub 12 minEvery clone holds the full history, and push, fetch and pull synchronise it with a remote such as a GitHub repository named origin.

devops / Remotes and GitHub — Push, Fetch, Pull

Explore each scene at your own pace.

01 · The rule

The rule

Remotes and GitHub — Push, Fetch, Pull

Your repository lives on your laptop. The deploy server, your teammates and the CI system all need the same history. A hosted remote, most often on GitHub, is the shared meeting point everyone syncs with.

The rule

Your repo is complete locally; push and pull only sync it with a remote.

Every Git clone holds the full history. A remote is simply another copy of the repository at a URL, conventionally named origin. GitHub hosts such copies and adds a web interface, access control, issues, pull requests and automation around them.

git clone git@github.com:acme/notes-api.git   # copy the repo and set origin
git remote -v                                 # list remotes and their URLs
git push -u origin feature/search             # publish a branch, remember the link
git fetch origin                              # download new commits, change nothing locally
git pull                                      # fetch, then merge into your branch
  • push sends your commits to the remote branch.
  • fetch downloads the remote's new commits into tracking branches such as origin/main, without touching your work.
  • pull is fetch plus merge (or rebase, if you configure it).

For authentication GitHub accepts SSH keys (URLs like git@github.com:...) or HTTPS with a personal access token. Account passwords do not work for Git operations.

If the remote has commits you do not have, Git rejects your push as "non-fast-forward". It will not overwrite others' work. You pull, resolve any conflicts, and push again.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.