linuxlab.io
Tutorials▾
  • Linux & networking
    File system, processes, TCP/IP, BGP and OSPF
    →
  • Terraform & IaC
    HCL, state, plan/apply on a LocalStack sandbox
    →
  • Git & GitHub
    Object model, plumbing, branching, GitHub Actions
    →
All tutorials →
PricingAboutSign inCreate account
/
Intro
Lessons
Footer
linuxlab-TutorialsPricingAboutPrivacy & cookies
Copyright © 2026 LinuxLab. All rights reserved.
linuxlab.io
Tutorials▾
  • Linux & networking
    File system, processes, TCP/IP, BGP and OSPF
    →
  • Terraform & IaC
    HCL, state, plan/apply on a LocalStack sandbox
    →
  • Git & GitHub
    Object model, plumbing, branching, GitHub Actions
    →
All tutorials →
PricingAboutSign inCreate account
/
  • Introduction
  • Chapters
  • How it works
  • Lessons
  • Knowledge base
  • Interview prep
home/git/kb/Open source/fork-vs-clone

kb/oss ── Open source ── beginner

Fork vs clone

Clone is a local copy of a repository. Fork is a copy **on the server** under your account. In open source you usually fork first (gaining write access to your copy), then clone the fork (to work locally), and open a PR from the fork back to the original.

view as markdownaka: fork-or-clone, github-fork

Two words that are easy to confuse. They are different operations at different levels.

Clone: a local copy

bash
git clone git@github.com:original/repo.git

What it does: creates a local copy of the repository on your machine. The remote repository stays unchanged. You get everything: history, branches, tags. Writes (push) work only if you have permissions on original/repo. Without them, git push will be rejected.

Details in clone.

Fork: a copy on the server

You fork through the forge's UI: the "Fork" button on GitHub/GitLab/Bitbucket. What happens: GitHub creates a full copy of the repository under your account:

Before:    github.com/original/repo
After:     github.com/original/repo
           github.com/you/repo        ← your copy

This is not local. It is a server-side operation: GitHub now has two repositories, your fork and the original. You are the full owner of your fork: you can push, create branches, delete things, whatever you like. Your fork has no effect on the original.

Typical open-source flow

1. Fork (in GitHub UI):     original/repo → you/repo
2. Clone your fork:         git clone git@github.com:you/repo.git
3. (optional) add the original as upstream (see [[upstream-vs-origin]])
4. Make changes, push to your fork
5. Open a PR on GitHub:     you:feature → original:main

This is the "fork flow." Most large open-source projects do not allow external contributors to push directly to the original; they simply do not have the permissions. A fork works around that: you have write access to your fork, you do the work there, and the original receives changes only through PRs.

When you do not need a fork

If you are a team member of the original repository with writer access, you do not need a fork. The cycle is simpler:

1. Clone the original
2. Branch inside it, push to the original
3. PR from branch to main, everything inside one repository

Small teams work exactly this way. A fork is a workaround for missing permissions, not "the proper way."

How fork and clone differ technically

WhatCloneFork
LivesLocally, your diskOn the server, your GitHub account
Initiated bygit clone commandUI on the forge
Affects the originalNoNo
Requires GitHubNo (works with any git URL)Yes (forge-specific feature)
How many timesAs many as you wantOne fork per account
Can pull from upstreamYes (via upstream-vs-origin)Yes (plus Sync button on GitHub)

One fork is one copy. If you need multiple copies, you need a different account or an organization.

Syncing a fork with upstream

Over time the original moves ahead and your fork falls behind. To sync:

Via UI: use the "Sync fork" button on your fork's page on GitHub. It performs a fast-forward when possible.

Via CLI:

bash
git fetch upstream
git switch main
git rebase upstream/main
git push origin main

The CLI works in any setup; the UI button works only in the standard flow. More detail in upstream-vs-origin.

When fork vs clone is a real decision

  • You want to modify your own project: clone, nothing else needed.
  • You want to contribute to someone else's open-source project: fork, then clone your fork.
  • You want to use someone else's code without modifying it: clone. A fork is an unnecessary extra step.
  • You want to create your own version of a project (for example, after a disagreement with the author): fork (you can treat it as a hard fork and develop it independently).

Pitfalls

  • "I forked, now I'll push to the original." No: a fork is your copy; push to it. Changes reach the original through a PR. See upstream-vs-origin.
    • The fork goes stale. After a year without syncing it can be many commits behind the original. Before opening a PR, always run fetch upstream + rebase.
    • Fork deleted from GitHub takes all its branches and issues with it. A PR from that fork to the original also becomes invalid. Keep a backup if the fork has unmerged branches.
  • Private fork of a public repository. GitHub does not let you fork a public repository into a private one directly. Use Import via the UI or mirror-push instead. With GPL this is legal as long as you keep modifications private: GPL imposes obligations (disclose source and preserve copyleft) only at the moment of distributing the binary or source to others; personal use is unrestricted.

§ см. также

  • clonegit cloneCreates a local copy of a remote repository. Under the hood: `init` + add origin + `fetch` the full history + `checkout` the default branch. The first command you run on any project you did not create yourself.
  • upstream-vs-originupstream vs originTwo conventional remote names. `origin` is where you cloned from (usually your fork). `upstream` is the "real" project you forked. This is just a convention: nothing is magic, both names can be renamed.
  • pull-requestPull Request (PR)A request to merge a branch into the main branch after passing review and CI. On GitHub/GitLab/Bitbucket it is the standard mechanism for collaborative work. Technically it is not a Git command but a hosting feature built on top of branches and commits.
  • licenseLICENSE: project licenseThe LICENSE file in the repository root defines the terms for using the code. Without a license, code is closed by default under copyright: you can view a public repository on GitHub (GitHub Terms of Service permit that), but you cannot copy, modify, or distribute it until the author explicitly grants permission. The most common licenses are MIT, Apache-2.0, and GPL.
Footer
linuxlab-
Copyright © 2026 LinuxLab. All rights reserved.
Tutorials
Pricing
About
Privacy & cookies