doc/user/group/custom_project_templates.md
{{< details >}}
{{< /details >}}
{{< history >}}
constrain_group_project_templates. Disabled by default.constrain_group_project_templates removed.{{< /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 you create a project outside of a group context, you must select a group from the dropdown list before you can browse its templates. Only groups you have access to are listed.
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 differs based on your permissions:
Protected branch and tag access levels are also affected when templates are copied:
Deploy keys and webhooks contain sensitive secrets. They are copied only when the identity that creates the project has the Owner role on the template project or has administrator access. When you create a project from a template by using the API, this identity depends on the token:
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:
Protected branch and tag access levels are also affected when templates are copied. For more information, see permissions and sensitive data.
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.