← Back to Articles         
Local vs Remote Repository and Fork vs Clone

Local vs Remote Repository and Fork vs Clone

Published on 03 Oct 2026     5 min read Git & GitHub
GitHub Fundamentals

Local vs Remote Repository and Fork vs Clone

1. What is the difference between a local Git repository and a GitHub remote repository?

What is a Local Git Repository?

A local Git repository is a Git repository stored on your own computer.

It contains:

  • Project files
  • Commit history
  • Local branches
  • Git metadata in the .git directory

For example:

C:\Projects\MyApp
    |
    ├── Controllers
    ├── Models
    ├── Program.cs
    └── .git

You can create one using:

git init

Or get one by cloning an existing remote repository:

git clone https://github.com/company/myapp.git

You perform normal development locally:

git status
git add .
git commit -m "Add login feature"
git branch
git switch feature/login

Most local Git operations do not require an internet connection.


What is a GitHub Remote Repository?

A GitHub remote repository is a Git repository hosted on GitHub.

It acts as a shared repository that developers can use for collaboration.

Developer A
Local Repository
       |
       | push
       ↓
GitHub Remote Repository
       ↑
       | pull
       |
Developer B
Local Repository

For example, the remote may be configured as:

git remote -v

Output could look like:

origin  https://github.com/company/myapp.git (fetch)
origin  https://github.com/company/myapp.git (push)

origin is the conventional default name Git gives the remote when you clone a repository.


How Local and Remote Repositories Communicate

Push local commits to GitHub

git push origin main

Flow:

Local Repository
      |
      | git push
      ↓
GitHub Remote Repository

Get remote changes

git fetch

This downloads remote updates without integrating them into your current branch.

Or:

git pull

This fetches remote changes and then integrates them into your current branch according to the configured pull behavior.

GitHub Remote
      |
      | fetch / pull
      ↓
Local Repository

Local vs GitHub Remote Repository

Local Repository GitHub Remote Repository
Stored on your computer Hosted on GitHub
Used for local development Used for sharing/collaboration
Local commits are stored here Pushed commits are shared here
Can work offline for most operations Network is needed to communicate with it
Contains local branches Contains remote repository branches
git commit records changes locally git push sends commits to the remote

Key Points

  • Git commits are normally created locally first.
  • git push sends local commits to GitHub.
  • git fetch downloads information about remote changes.
  • git pull fetches and integrates remote changes.
  • origin is usually the default remote name after cloning.
  • GitHub is not your local Git repository; it hosts a remote copy used for collaboration.

2. What is the difference between fork and clone?

What is Clone?

A clone creates a local copy of a Git repository on your computer.

For example:

git clone https://github.com/company/myapp.git

Flow:

GitHub Repository
       |
       | git clone
       ↓
Your Computer
Local Repository

After cloning, you can work locally:

cd myapp

git switch -c feature/login

git add .
git commit -m "Add login feature"

git push

Whether you can push to the original remote depends on your permissions.


What is a Fork?

A fork creates a separate copy of someone else's repository under your own GitHub account or organization.

Suppose the original repository is:

github.com/company/myapp

You fork it.

Now GitHub may contain:

Original
company/myapp

       ↓ Fork

Your GitHub Account
yourname/myapp

Both repositories are on GitHub.

You can then clone your fork:

git clone https://github.com/yourname/myapp.git

Now:

Original GitHub Repository
company/myapp
        |
        | Fork
        ↓
Your GitHub Repository
yourname/myapp
        |
        | Clone
        ↓
Your Computer
Local Repository

This is the most important distinction:

Fork = remote-to-remote copy on GitHub.
Clone = remote-to-local copy on your computer.


Why Do We Use Forks?

Forks are especially useful when you do not have direct write access to the original repository.

For example, in an open-source project:

Original Repository
        ↓
      Fork
        ↓
Your GitHub Repository
        ↓
      Clone
        ↓
Local Development
        ↓
      Commit
        ↓
      Push
        ↓
Your Fork
        ↓
Pull Request
        ↓
Original Repository

You make changes in your fork and then create a Pull Request asking the original project's maintainers to merge your changes.


Fork vs Clone

Fork Clone
Creates another remote repository Creates a local repository
Usually done on GitHub Done using Git
Copy exists under your account/org Copy exists on your computer
Useful when you don't have write access Used for local development
Common in open-source contribution Common in virtually all Git development
Can be followed by a Pull Request to the original repo Local changes are committed and then pushed to a remote

Simple Example

Suppose Microsoft owns:

microsoft/project

You fork it:

microsoft/project
       ↓
      Fork
       ↓
syed/project

Then clone your fork:

git clone https://github.com/syed/project.git

Now:

microsoft/project
      Original
         |
         | fork
         ↓
   syed/project
      Your Fork
         |
         | clone
         ↓
   Your Computer
   Local Repository

You make changes:

git switch -c fix/login-bug

git add .
git commit -m "Fix login bug"

git push -u origin fix/login-bug

Then you can create a Pull Request from your fork/branch to the original repository.

Key Points

  • Clone is a Git operation.
  • Fork is primarily a hosting-platform concept provided by services such as GitHub.
  • Fork creates a separate repository on GitHub.
  • Clone creates a local repository on your computer.
  • You can clone a repository without forking it.
  • Forking is particularly useful when contributing to repositories where you don't have direct write permission.

Easy Interview Answer

A clone copies a remote Git repository to my local computer so I can work on it. A fork creates my own remote copy of another repository on GitHub. In open-source development, I typically fork the original repository, clone my fork locally, make and push changes, and then create a Pull Request to the original repository.

← Back to Articles