mislav / hub

A command-line tool that makes git easier to use with GitHub.
https://hub.github.com/
MIT License
22.84k stars 2.2k forks source link

Support Repository Templates #2163

Open jamiekyle-eb opened 5 years ago

jamiekyle-eb commented 5 years ago

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
odon0007 commented 5 years ago

这个鬼东东怎么用起来?

jamiekyle-eb commented 5 years ago

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.

odon0007 commented 5 years ago

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.

mislav commented 5 years ago

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.

mislav commented 5 years ago

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.

kandice1978 commented 5 years ago

Seems simple

mislav commented 5 years ago

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:

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.

mislav commented 5 years ago

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

ericovasconcelos commented 4 years ago

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