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
这个鬼东东怎么用起来?
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:
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:git init
;git push -u origin HEAD
.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.
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