1

There's a lot covered about how to make a fork of a public repo private. The primary use case is where you want to work on a fork and keep it updated with the source, but won't be making contributions back.

E.g. you are bespoking it for another project and the commits are too specific.

This is probably the most comprehensive answer. In short:

  1. Create a new private repo
  2. Import the public repo
  3. Then pull with git pull public master and git push origin master

However, this approach doesn't keep the github web interface updated with how many commits you are behind/ahead of the public master, per the standard fork below:

enter image description here

Is there a way to set this up so github.com still compares the private fork to the public repo?

alias51
  • 8,178
  • 22
  • 94
  • 166

1 Answers1

5

When you make a fork of a public repository private, you completely separate it from the original repository. This is because GitHub shares objects between repositories that are related (in GitHub parlance, in the same repository network), and otherwise it would be possible for other users to see objects in your repository if they knew the object ID. Since this is undesirable, they're separated completely.

Consequently, there isn't a way to make a public fork private and compare it against the original, since it's no longer considered a fork of the original. You'll need to use the standard Git commands if you want to see how far ahead or behind you are with upstream.

bk2204
  • 64,793
  • 6
  • 84
  • 100
  • Thanks, that's very helpful. Is there a way to still use the conflict editor on github.com to resolve simple merge conflicts that result from this? – alias51 Mar 10 '20 at 09:41
  • Possibly, if you push upstream's `master` branch to your repository (e.g., as `upstream`) and do the merge that way. – bk2204 Mar 10 '20 at 11:48