Git · Lesson 4 of 6
Remotes & GitHub
Connecting to GitHub, push, pull, clone and fetch.
A remote is a copy of the repository somewhere else — usually GitHub. By convention the main one is called origin.
git clone URL— download a repository with its full history.git remote add origin URL— link an existing local repo to GitHub.git push -u origin main— upload your commits (-uremembers the link for next time).git pull— download others' commits and merge them into your branch.git fetch— download without merging, so you can inspect first.
GitHub asks you to sign in with a personal access token or SSH key rather than your password.
Example in the terminal
Run these on your own computer$ git remote add origin https://github.com/anu-kumar/job-tracker.git
$ git push -u origin main
Enumerating objects: 6, done.
To https://github.com/anu-kumar/job-tracker.git
* [new branch] main -> main
branch 'main' set up to track 'origin/main'.
# On another laptop
$ git clone https://github.com/anu-kumar/job-tracker.git
$ cd job-tracker
$ git pull
Already up to date.
Lines starting with $ are commands you type; the rest is what Git prints. Names and URLs are examples.
Key points
- origin = the default remote name.
- push uploads, pull downloads + merges.
- clone copies a repo with its history.
Quick check
Which command downloads changes without merging them?
git fetch only downloads; git pull = fetch + merge.
Practice task
Create an empty repository on GitHub, push your local job-tracker repo to it and confirm the files appear on the website.
Interview corner
git pull vs git fetch?
fetch updates your remote-tracking branches but leaves your work untouched. pull does a fetch and then merges (or rebases) into your current branch.
What is a fork?
Your own copy of someone else's repository on GitHub. You push to your fork and open a pull request back to the original.
Further reading
Official documentation, linked for deeper study. These are outside sites; this lesson's text is our own.
Original lesson written by the InfoparkDaily team · © 2026 InfoparkDaily · Free to learn — no paid course or subscription.