Creating a repo off a public template repository

Hello, is there any way or is there planned to be any way to create repositories off of template repositories that I don’t have membership too?

As in, if there’s an organization that created a starter repository and has made it both public and a template, can someone unaffiliated with that organization create a repo from that template?

I’m working on a feature that allows users to fork a starter project, all through the GitHub api, that we provide and that they can then build off of. But because they’re not going to want to merge their fork back into our starter, a fork doesn’t really make sense. But being able to provide a starter that’s a template repository that they can use to create a new repo would be ideal. The problem is they won’t be part of our organization so it won’t work.

I know they could just clone the repo but the idea is that we manage creating the repo for them, through the GitHub api, to make it a bit easier.

Yes, and once you’ve used that template it will keep showing up in your template choices whenever you create a new repository via GH WebUI.

As long as you are offering the repository template they’ll be able to use it to create new and independent repositories from it. A repository template is just a repository which you decide to turn into a template from it’s control panel.

So, if you’ve seen a template you like, you can just fork it and make it available through your account (user or org, it doesn’t matter) — i.e. license permitting, of course.

The GH API might make things harder in this respect. The simplest thing would be to simply host a repo template and let your users rely on it as the starting point of their repositories. Using a template is not forking, the resulting repository is not connected to its template via shared Git history.

Thanks @tajmone for all the info! I’ve been messing around with the template api the last couple days and I managed to get it working the way I hoped. The apis are still in preview mode so I won’t be using it in prod, but once they’re official I hope to incorporate them.

The two pain points that I ran into setting it up is that first, an OAuth app is required; GitHub apps don’t work with the new api. And second that the OAuth app has to be created on the organization that’s hosting the template repository.

But I managed to get it working where a user that isn’t a part of our org could simply press a button and through the apis, we create a new repo in their account using our repo template.

1 Like