doc/user/group/custom_project_templates.md
{{< details >}}
{{< /details >}}
{{< history >}}
constrain_group_project_templates.
Disabled by default.{{< /history >}}
When you create a project, you can choose from a list of templates. These templates, for things like GitLab Pages or Ruby, populate the new project with a copy of the files contained in the template. This information is identical to the information used by GitLab project import/export and can help you start a new project more quickly.
You can customize the list of available templates, so that all projects in your group have the same list. To do this, you populate a subgroup with the projects you want to use as templates.
You can also configure custom templates for the instance.
Prerequisites:
To set up custom project templates in a group, add the subgroup that contains the project templates to the group settings:
The next time a group member creates a project, they can select any of the projects in the subgroup.
Projects in nested subgroups are not included in the template list.
When the constrain_group_project_templates feature flag is enabled, users creating a project
outside of a group context must select a group from a dropdown list before browsing its templates.
Only groups the user has access to are listed.
A known issue exists:
Inherited members can't select project templates,
unless the project_templates_without_min_access feature flag is enabled.
This feature flag is disabled
on GitLab.com, and so users must be granted direct membership of the template project.
Here's a sample group and project structure for project templates, for myorganization:
# GitLab instance and group
gitlab.com/myorganization/
# Subgroups
internal
tools
# Subgroup for handling project templates
websites
templates
# Project templates
client-site-django
client-site-gatsby
client-site-html
# Other projects
client-site-a
client-site-b
client-site-c
...
When you create a project from a template, all exportable project items are copied from the template to the new project. These items include:
For a complete list of what is copied, see project items that are exported.
The copying behavior might differ based on your permissions:
When you use a template created by another user, any items that were assigned to a user in the template are reassigned to you. It's important to understand this reassignment when you configure security features like protected branches and tags. For example, if the template contains a protected branch:
Custom project templates for a group are available only to group members. If the administrator account you are using is not a member of a group, you can't access the templates.