Sitemap
abhijit chanda

abhijit chanda

Software Developer and Scrum Master. My definition of being a software developer includes Architect, Designer or Tester roles

To fork or not to fork a Github repo

2 min readDec 29, 2025

There are several very practical reasons someone might choose not to fork a GitHub repo and instead copy (clone + repoint) the contents.

If you need your repository to be private, forking a public GitHub repo won’t work — GitHub doesn’t allow private forks of public projects on personal accounts. A fork will always remain public and visibly linked to the original source.

In this case, you can clone the repo locally, create a new private repo, and repoint the remote. This gives you:

  • A fully private repository
  • No visible “forked from” lineage
  • Freedom to restructure or evolve the project independently

This is the simplest and cleanest way to start from someone else’s code while keeping your own work private.

Get abhijit chanda’s stories in your inbox

Join Medium for free to get updates from this writer.

You can do this using the Import repository option on the GitHub site or visit https://github.com/new/import.

Steps to clone a code repository and push it to your own GitHub account using command line

Imagine you’ve cloned a GitHub repo into a local folder using the following command:

 git clone https://github.com/pkellner/pluralsight-working-with-components-in-react18.git

This will create a new folder named pluralsight-working-with-components-in-react18 , and the contents of the repository will be copied into it.

You can verify the remote repository URL using the following command:

git remote -v
origin https://github.com/pkellner/pluralsight-working-with-components-in-react18.git (fetch)
origin https://github.com/pkellner/pluralsight-working-with-components-in-react18.git (push)

You can always repoint this to your own GitHub repo, , but first you’ll need the URL of your new repository. Let’s create that repo directly from within the local project folder. Note that I’m using Github CLI command gh repo create .

cd .\pluralsight-working-with-components-in-react18\

gh repo create pluralsight-working-with-components-in-react18 --private --source=. --remote=upstream
✓ Created repository unowiz/pluralsight-working-with-components-in-react18 on github.com
https://github.com/unowiz/pluralsight-working-with-components-in-react18
✓ Added remote https://github.com/unowiz/pluralsight-wor

At this point, you’ll notice that the cloned folder now has an additional remote URL named upstream . Since I want my local repository to point only to my own GitHub repo, I’ll remove the original remote url using git remote remove command.

git remote -v
origin https://github.com/pkellner/pluralsight-working-with-components-in-react18.git (fetch)
origin https://github.com/pkellner/pluralsight-working-with-components-in-react18.git (push)
upstream https://github.com/unowiz/pluralsight-working-with-components-in-react18.git (fetch)
upstream https://github.com/unowiz/pluralsight-working-with-components-in-react18.git (push)

git remote remove origin

git remote -v
upstream https://github.com/unowiz/pluralsight-working-with-components-in-react18.git (fetch)
upstream https://github.com/unowiz/pluralsight-working-with-components-in-react18.git (push)

And now, you are good to push the local repo contents to your GitHub remote repository.

git push

--

--

abhijit chanda
abhijit chanda

Written by abhijit chanda

Software Developer and Scrum Master. My definition of being a software developer includes Architect, Designer or Tester roles