Git & GitHub · Daily Workflow

Cloning a Repository

Cloning downloads a repository with its full history and connects it to GitHub so you can push and pull.

Beginner 5 min Lesson 7 of 19Shows Git 2.47 and GitHub.com as of 2026. GitHub changes its layout from time to time; button names stay the same.
0/19 in Git & GitHub
On this page · 5 min · Beginner

Learning objectives#

  • Find the clone URL
  • Clone with the terminal and with VS Code
  • Choose HTTPS or SSH
  • Know how clone differs from Download ZIP

Explanation#

On the repository page, the green <> Code button shows the clone URL. HTTPS works everywhere and signs in through your browser the first time (Git Credential Manager on Windows). SSH uses a key you add to GitHub once and never asks again.

git clone <url> creates a folder with the repository name, downloads every commit and sets up a remote called origin pointing back to GitHub.

In VS Code: Ctrl+Shift+P → Git: Clone → paste the URL → choose a parent folder → Open. GitHub Desktop has File → Clone repository, with a list of your repositories.

Download ZIP gives you only the files: no history and no connection to GitHub. Use it to look at code, not to work on it.

Step-by-step screens#

Drawings of github.com, the Git installer, VS Code and a terminal. GitHub changes its layout from time to time; the button names stay the same. The red numbers match the numbered actions under each picture; names on your computer will differ.

Loading pictures…

Code example: Clone and look around#

ShellClone and look around Illustrative
cd C:\dev
git clone https://github.com/asha/hello-github.git
cd hello-github
git remote -v
git log --oneline -3
Expected output
Cloning into 'hello-github'...
remote: Enumerating objects: 12, done.
Receiving objects: 100% (12/12), done.
origin  https://github.com/asha/hello-github.git (fetch)
origin  https://github.com/asha/hello-github.git (push)
3f9c2a1 Add a welcome line
8d41e07 Add style.css
1a2b3c4 Initial commit

This example is illustrative. Copy or download it and run it in your own environment; the expected output is shown above.

Step-by-step explanation#

  1. Choose a folder for your projects first.
  2. git clone downloads and creates hello-github/.
  3. origin is the name of the GitHub copy.
  4. git log shows the history came along too.

Real-world use case#

A new team member clones the company repository on day one and runs the project without anyone emailing zip files.

Common mistakes#

Cloning inside another repository

A repo inside a repo confuses Git. Keep projects side by side in a folder such as C:\dev.

Using Download ZIP to work

There is no history and you can’t push. Clone instead.

Best practices#

  • Keep all projects in one folder (C:\dev)
  • Use SSH once you push often
  • Never work from a ZIP
  • Pull before you start each day

Remember this#

<> Code → copy URL.

git clone URL.

origin = GitHub copy.

Practice exercise#

Your task: Show where your repository pushes to.

Show solution
Shell Illustrative
git remote -v

Mini quiz#

Cloning a Repository quizMultiple choice Question 1 of 1

What does Download ZIP not give you?

Score so far: 0/0

Want more? Practise all Git & GitHub MCQs · Git & GitHub interview questions

My notes#

Saved in this browser.

Progress is saved in this browser. Sign in to sync.