Hub: Support Repository Templates

Created on 7 Jun 2019  ·  9Comments  ·  Source: github/hub

GitHub just added support for using repositories as templates it would be great if the hub create command supported them:

hub create -t user/repo
feature

Most helpful comment

An example of a manual approach for generating repositories from templates using hub api: https://github.com/mislav/hub-api-utils/blob/master/bin/hub-create-from-template

All 9 comments

这个鬼东东怎么用起来?

I'm translating the above as "How is this [adj: ] thing used?" (Sorry I can't translate 鬼 in context)


From the /generate page on a "template" repository, you can create a new repository by copying the contents of the template repository (without its git history I assume).

However, it appears that GitHub has not yet built an API endpoint for doing the same programatically. So hub may not be able to do this yet.

I'm translating the above as "How is this [adj: ] thing used?" (Sorry I can't translate 鬼 in context)

From the /generate page on a "template" repository, you can create a new repository by copying the contents of the template repository (without its git history I assume).

However, it appears that GitHub has not yet built an API endpoint for doing the same programatically. So hub may not be able to do this yet.

Yes, you're right.

Great idea, but the GitHub API doesn't support repo templates yet, and until it does, there's nothing that we can do from hub.

Closing to keep the issue backlog clean.

Will reopen as this will likely be re-requested more and people need to understand that we are unable to implement this right now, but that we might be in the future.

Seems simple

This API is now available under preview: https://developer.github.com/v3/repos/#create-repository-using-a-repository-template

However, it doesn't fit into how hub create is currently designed:

  • The create command is meant to be used within an _existing local git repo_ to create a destination on GitHub for it to be pushed to. The rough steps are:

    1. Within existing working directory: git init;

    2. Create GitHub repository;

    3. git push -u origin HEAD.

  • Creating a GitHub repo from a template would create a new repository that would _then need to be cloned locally_ into a new local git repo. The rough steps would be:

    1. Create a GitHub repository from template;

    2. Clone the new repository.

So you see, these operations would have completely orthogonal uses. This is why at the moment, I suggest that we don't extend the hub create command with template repo functionality.

An example of a manual approach for generating repositories from templates using hub api: https://github.com/mislav/hub-api-utils/blob/master/bin/hub-create-from-template

It would be good to have it in hub directly. But thanks for the api solution.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

le0nik picture le0nik  ·  4Comments

jfritzbarnes picture jfritzbarnes  ·  3Comments

kentcdodds picture kentcdodds  ·  4Comments

Kristinita picture Kristinita  ·  4Comments

eromoe picture eromoe  ·  4Comments