Stop 05 · Git & GitHubTopics · 2/11

Clone

Part of the Frontend Developer Roadmap

In short

Want to work on a project that already lives on GitHub? You don't download a zip. You clone it and get every file plus the full history.

`git clone <url>` downloads a full copy of a remote repository — including its entire history — onto your machine, ready to work on. Cloning also configures a remote reference so you can fetch updates and collaborate without manually rebuilding the repository history.

The jaadu mascot photocopies an entire notebook page by page while holding the original.

Think of it like this

Photocopying a topper's notes

A zip download is like getting just the final page. Cloning is photocopying the whole notebook, every page and every edit. Plus, your copy remembers whose notebook it came from, so you can collect new pages later.

Watch it happen

What git clone does

Your laptop
GitHub

git clone <url>

1/5Your laptop asks GitHub for the whole repository at that URL.

The big ideas

What you need to know

Full copy, full history

git clone downloads all files, all commits and all branches onto your machine.

origin is set for you

Git remembers where you cloned from and calls it origin. git pull and git push talk to it.

HTTPS or SSH

HTTPS works out of the box with a token. SSH uses a key on your laptop, so you skip typing credentials.

Fork first for others' repos

You can't push to someone else's repo. Fork it on GitHub, then clone your fork.

See it in code

Walk through the code

bash
1# Clone into a folder with the repo's name2git clone https://github.com/vercel/next.js.git3 4# Clone into a folder name you choose5git clone git@github.com:your-name/portfolio.git my-site6 7cd my-site8git remote -v        # shows where origin points9git log --oneline -5 # last 5 commits

1/4Clone over HTTPS. Git creates a folder named after the repo, here next.js.

The first URL is HTTPS and the second is SSH. Both get the same repo. git remote -v confirms which one your copy uses.

Save yourself the pain

Common mistakes

Oops

Downloading the zip from GitHub and then wondering why git pull doesn't work.

Do this instead

A zip has no .git folder. Use git clone so your copy stays connected to the original.

Oops

Cloning a repo inside another repo's folder.

Do this instead

Clone into a normal folder like ~/projects. Nested repos confuse both of them.

Your mission

Clone and explore

~15 min

Quick check

After git clone, why can you run git pull without typing any URL?

Go deeper

  1. 1Clone a public open-source repo and explore its commit history with `git log`. Validate your understanding by applying it in a small practical example.
  2. 2Learn the difference between HTTPS and SSH clone URLs. Focus on understanding the underlying reason it works, not only memorizing the definition.
  3. 3Practice cloning, making a change, and pushing it to your own fork.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge