Guide

How do you fork a GitHub repository?

Updated July 19, 2026 · WarmStars

Short answer

A fork is your own server-side copy of someone else's repo. Open the repo, click Fork at the top right, pick an owner, click Create fork. Then clone the fork, add the original as an upstream remote so you can pull updates, and open a pull request to send changes back.

  • Fork = your copy on GitHub. Push to it all you want, the original never notices.
  • Fork button (top right), pick owner, Create fork. Then `git clone` your fork.
  • Add the original as `upstream`, run `git fetch upstream`, merge. That is how you stay current.
  • Branch, commit, `git push origin`, open a PR. Your changes travel back to the original.

Why fork instead of just cloning?

Two copies, two machines. A fork lives on GitHub's servers under your account. A clone lives on your laptop. Fork acme/rocketdb and you get a brand-new repo at github.com/dev-priya/rocketdb, full history, its default branch, yours to push to. Run git clone and you pull a repo down to disk instead. Forking is a GitHub feature. Cloning is plain Git (the split in one line).

You fork for exactly one reason: you cannot push to the original. Open-source maintainers do not hand out write access to strangers, so a fork is how you propose changes without asking. Already got push rights as a collaborator? Skip all of this. Branch inside the main repo and move on.

How do you fork it and clone it down?

Fork on the web, clone on your machine. In that order.

1. Open github.com/acme/rocketdb while signed in. 2. Click Fork. Top right, next to Star and Watch. The number beside it is the current fork count. 3. Pick the owner on the Create a new fork screen: your account, or an org you belong to. No orgs means your account is the only option. 4. Rename it or edit the description if you want. Most people do not bother. Same name is fine. 5. Leave Copy the default branch only checked to grab just main. That is what you want almost every time. Uncheck it only if you need every branch. 6. Click Create fork. A few seconds later you land on github.com/dev-priya/rocketdb.

Now clone the fork, not the original. Grab the URL from the green Code button.

git clone https://github.com/dev-priya/rocketdb.git
cd rocketdb

Check what you got:

git remote -v

One remote, origin, pointing at your fork. That is where git push lands. Add the original as upstream so you can pull maintainer updates later:

git remote add upstream https://github.com/acme/rocketdb.git

Two remotes now, two jobs. origin is your fork, you push here. upstream is the original, you pull from here. That split is the whole game.

How do you stay current and ship a PR?

Forks do not update themselves. Yours is frozen at the second you created it. When the project moves ahead, you pull the commits in by hand or your PR will not apply cleanly.

git fetch upstream
git checkout main
git merge upstream/main
git push origin main

Want linear history? Swap the merge for git rebase upstream/main. It replays your commits on top of upstream and rewrites the commit hashes, so never rebase a branch other people already pulled.

Hate the terminal? GitHub has a Sync fork control above the file list whenever you are behind. Click it, then Update branch. Or one line from the CLI: gh repo sync dev-priya/rocketdb -b main.

Now the PR. Never work on main. Branch first.

git checkout -b fix-readme-typo
git add .
git commit -m "Fix typo in README install steps"
git push origin fix-readme-typo

That pushes to origin, your fork. Right after, GitHub throws up a Compare & pull request banner. Click it. Miss it, and you open the original repo, hit New pull request, set base to acme/rocketdb main and compare to dev-priya/rocketdb fix-readme-typo. Write a clear title, a short why, click Create pull request. Any new commits you push to that branch update the same PR automatically. On GitLab this exact flow is called a merge request.

What breaks, and how do you dodge it?

Five traps, roughly in order of how often people hit them.

1. Committing on your fork's `main`. Sync later and it turns into a mess. Always branch. main stays a clean mirror of the original.

2. Expecting the fork to auto-update. It never does. Sync before you start work.

3. Trying to make a public fork private. Cannot be done. Public forks stay public and sit in the same repository network. Need a private copy? Use GitHub's import or duplicate-a-repository flow, not the Fork button.

4. Forking your own repo into the same account. GitHub allows one fork per account, so dev-priya/rocketdb cannot fork back into dev-priya. Fork it into another org you own, or duplicate it under a new name.

5. Fearing the Delete button. Do not. Deleting your fork (Settings, then the Danger Zone) never touches the original repo or any PR you already merged. It only removes your copy.

1 branch
What a fork copies by default. Uncheck the default-branch-only box to copy all of them.

Common questions

What is the difference between a fork and a branch?
A branch is a parallel line of work inside one repo: same owner, same permissions, same remotes. A fork is a separate copy under a different owner. Collaborators branch for every feature. Outsiders who cannot push fork first, then branch inside their fork.
What is the difference between a fork and a clone?
A fork is a server-side copy on GitHub, made with the Fork button. A clone is a local copy on your machine, made with `git clone`. Fork once, then clone the fork. Clone the original directly and you still cannot push back without write access.
Do forks update automatically when the original changes?
No. A fork is frozen at the moment you create it. Catch up by adding the original as an `upstream` remote and running `git fetch upstream` followed by a merge or rebase. Or click `Sync fork` on GitHub. Or run `gh repo sync` from the CLI.
Can you fork a private repository?
Yes, if you have access and the org allows forking. The fork stays private and inherits the original's permissions, so only people already permitted can see it. Org owners can disable private-repo forking entirely in member-privileges settings, which greys out the Fork button.
How do you delete a fork?
Open your fork, go to Settings, scroll to the Danger Zone at the bottom, click Delete this repository, and type the full name (owner/repo) to confirm. It removes your copy only. The original repo and any PRs you already merged are untouched.
Can you fork your own repository?
Not into the same account, since GitHub allows one fork per owner. Fork it into a different org you belong to instead. Want a fresh, independent copy in your own account? Use GitHub's import or duplicate-a-repository flow, not the Fork button.
get started

Meet the people behind your stars.

Free to start. Two scans a month, no credit card.