Github does not provide an easy way to create a repository with predefined settings from another repository. A template repository for instance is only useful to copy the contents. No repository settings are copied.
This gh cli extension creates a new repository based on another one (A normal or template one).
It copies the following:
- The content with a single commit
- Basic repository settings
- Branch protections
- Organization teams (collaborators)
- Topics
gh extension install DoodleScheduling/gh-bootstrap-repository
The following command will attempt to create a repository called myorg/my-repository
with all the settings and content taken from myorg/from-repository
.
gh bootstrap-repository myorg/my-repository myorg/from-repository
Command line help:
expects [repository-name] [origin-repository] as arguments
Usage:
gh-bootstrap-repository [repository-name] [origin-repository] [flags]
Flags:
-h, --help help for gh-bootstrap-repository
It is required to be in the list of repository admins in the origin repository. The repository creation will fail otherwise.