7

I really liked the feature GitHub Template Repository where according to the documentation

After you make your repository a template, anyone with access to the repository can generate a new repository with the same directory structure and files.

What I also want to accomplish is to copy the the labels and settings of the template repository. This would ease processes and bring in standardisation.

Following could be the possible settings which I would like to be inherited from template repository

  • Disable Allow merge commits
  • Rule of master branch i.e. Protected branches
  • GitHub pages source should be master branch /docs folder
  • Activate After pull requests are merged, you can have head branches deleted automatically

Have you tried this ? If yes, how were you able to do it ?

paul58914080
  • 282
  • 3
  • 8

2 Answers2

4

2023: ruleset and repository rules can help set tules on branches.

2020: For now, "Creating a repository from a template" does not extends to settings, only repository structure.

If said repository is part of an organization, you have a common set of settings you (as administrator of that organization) can manage.


Note: Jorge Leitao adds in the comments:

As of today (Jan. 2023) org-level settings do not support branch rules nor most of project settings (even Enterprise Plan)

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Well this is certainly helpful for adding global organisation settings. However I was more looking for template specific too. Maybe we need to wait for template repository to also extend to settings as well. Or have GitHub actions perform these additional steps of copying settings. – paul58914080 Mar 30 '20 at 06:28
  • 1
    @paul58914080 GitHub Action would be a possible solution indeed, provided there is a GitHub API for modifying those settings. Regarding template, I don't know of any template-specific settings. – VonC Mar 30 '20 at 06:31
  • As of today org-level settings do not support branch rules nor most of project settings (even Enterprise Plan) – Jorge Leitao Jan 19 '23 at 05:43
0

As of today, there is a Beta version of the "Repository Ruleset" https://github.com/orgs/community/discussions/52652, sadly available only for organizations with Enterprise subscription.

igiona
  • 31
  • 4