Is it possible to fork a public GitHub repo into an enterprise repository?

It’s not possible, because your GitHub Enterprise (GHE) installation is separate from the public one, so there’s no way for the two systems to track each other’s branch relationships.

The best you can do is exactly as you describe: Clone the repo, then push it to your GHE installation, and yes, you will then lose the branching relationships across repos.

The other option would be to keep a fork on the public GitHub (GH) repo–possibly keeping it in sync (manually, or with a cronjob) with your GHE repo. Then you’ll have two instances of your repo, and the public one would retain branch relationships with the original repo.

Depending on why you need to put this on GHE, it may or may not work. If you’re making private contributions, it clearly won’t work–as your private contributions would no longer be private. If you want it on GHE due to some corporate policy that all open source projects used internally are kept on the GHE, or something similar, then it would work, with the added administrative overhead of keeping the repo in sync two places.

Leave a Comment