diff --git a/doc/api/settings.md b/doc/api/settings.md index c5dc8bbe8435baa17732bbb4ee95a28b44b8171e..6b99a35bb91eb8c862ed43a126bca9f28e914c48 100644 --- a/doc/api/settings.md +++ b/doc/api/settings.md @@ -449,7 +449,7 @@ to configure other related settings. These requirements are | `deactivate_dormant_users_period` | integer | no | Length of time (in days) after which a user is considered dormant. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/336747) in GitLab 15.3. | | `decompress_archive_file_timeout` | integer | no | Default timeout for decompressing archived files, in seconds. Set to 0 to disable timeouts. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/129161) in GitLab 16.4. | | `default_artifacts_expire_in` | string | no | Set the default expiration time for each job's artifacts. | -| `default_branch_name` | string | no | [Instance-level custom initial branch name](../user/project/repository/branches/default.md#instance-level-custom-initial-branch-name). | +| `default_branch_name` | string | no | [Set the initial branch name](../user/project/repository/branches/default.md#change-the-default-branch-name-for-new-projects-in-an-instance) for all projects in an instance. | | `default_branch_protection` | integer | no | [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/408314) in GitLab 17.0. Use `default_branch_protection_defaults` instead. | | `default_branch_protection_defaults` | hash | no | [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/408314) in GitLab 17.0. For available options, see [Options for `default_branch_protection_defaults`](groups.md#options-for-default_branch_protection_defaults). | | `default_ci_config_path` | string | no | Default CI/CD configuration file and path for new projects (`.gitlab-ci.yml` if not set). | diff --git a/doc/user/group/manage.md b/doc/user/group/manage.md index 5a13275faff93d3c562e33d7150192f29d73b7f0..00b567595a0c28520852a553507e9cc147ba6a3d 100644 --- a/doc/user/group/manage.md +++ b/doc/user/group/manage.md @@ -84,20 +84,18 @@ For more information about our solution to mitigate this timeout risk, see [issu ## Change the default branch protection of a group -By default, every group inherits the branch protection set at the global level. - -To change this setting for a specific group, see [group level default branch protection](../project/repository/branches/default.md#group-level-default-branch-protection). - -To change this setting globally, see [initial default branch protection](../project/repository/branches/default.md#instance-level-default-branch-protection). - -NOTE: -In [GitLab Premium or Ultimate](https://about.gitlab.com/pricing/), GitLab administrators can choose to [disable group Owners from updating the default branch protection](../project/repository/branches/default.md#prevent-overrides-of-default-branch-protection). +The administrator of a GitLab instance can configure default branch protections for +[all projects in an instance](../project/repository/branches/default.md#for-all-projects-in-an-instance). +Groups in that instance inherit the branch protection set at the global level. Group owners can +[override the instance settings](../project/repository/branches/default.md#for-all-projects-in-a-group) +for projects in a group. In [GitLab Premium or Ultimate](https://about.gitlab.com/pricing/), the administrator +of the instance can disable this privilege. ## Use a custom name for the initial branch When you create a new project in GitLab, a default branch is created with the first push. The group Owner can -[customize the initial branch](../project/repository/branches/default.md#group-level-custom-initial-branch-name) +[customize the initial branch](../project/repository/branches/default.md#change-the-default-branch-name-for-new-projects-in-a-group) for the group's projects to meet your group's needs. ## Transfer a group diff --git a/doc/user/project/repository/branches/default.md b/doc/user/project/repository/branches/default.md index d7b2e124b5bcc89e05d87eeb809d4e929f0b273c..c0b9b32bf8d2510e3f59693ebd14d6b2e983768d 100644 --- a/doc/user/project/repository/branches/default.md +++ b/doc/user/project/repository/branches/default.md @@ -27,9 +27,9 @@ GitLab checks first for specific customizations, then checks at a broader level, using the GitLab default only if no customizations are set: 1. A [project-specific](#change-the-default-branch-name-for-a-project) custom default branch name. -1. [Custom group default branch name](#group-level-custom-initial-branch-name) specified in project's direct subgroup. -1. [Custom group default branch name](#group-level-custom-initial-branch-name) specified in project's top-level group. -1. A custom default branch name set for the [instance](#instance-level-custom-initial-branch-name). +1. [Custom group default branch name](#change-the-default-branch-name-for-new-projects-in-a-group) specified in a project's direct subgroup. +1. Custom group default branch name specified in a project's top-level group. +1. A custom default branch name set for the [instance](#change-the-default-branch-name-for-new-projects-in-an-instance). 1. If no custom default branch name is set at any level, GitLab defaults to `main`. In the GitLab UI, you can change the defaults at any level. GitLab also provides @@ -54,13 +54,7 @@ To update the default branch for an individual [project](../../_index.md): API users can also use the `default_branch` attribute of the [Projects API](../../../../api/projects.md) when creating or editing a project. -## Change the default branch name for an instance or group - -GitLab administrators can configure a new default branch name for the -[entire instance](#instance-level-custom-initial-branch-name) or for -[individual groups](#group-level-custom-initial-branch-name). - -### Instance-level custom initial branch name +## Change the default branch name for new projects in an instance DETAILS: **Tier:** Free, Premium, Ultimate @@ -80,9 +74,13 @@ Projects created on this instance after you change the setting use the custom branch name, unless a group or subgroup configuration overrides it. -### Group-level custom initial branch name +## Change the default branch name for new projects in a group + +Prerequisites: + +- You must have the Owner role for the group and subgroups. -Users with the Owner role of groups and subgroups can configure the default branch name for a group: +To change the default branch name for new projects in a group: 1. On the left sidebar, select **Search or go to** and find your group. 1. Select **Settings > Repository**. @@ -102,9 +100,7 @@ DETAILS: > - Full protection after initial push [introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/118729) in GitLab 16.0. GitLab administrators and group owners can define [branch protections](protected.md) -to apply to every repository's default branch -[for the instance](#instance-level-default-branch-protection) and -[individual groups](#group-level-default-branch-protection) with one of the following options: +to apply to every repository's default branch for the instance, or for individual groups, with one of these options: - **Fully protected** - Default value. Developers cannot push new commits, but maintainers can. No one can force push. @@ -120,7 +116,7 @@ to apply to every repository's default branch WARNING: Unless **Fully protected** is chosen, a malicious developer could attempt to steal your sensitive data. For example, a malicious `.gitlab-ci.yml` file could be committed to a protected branch and later, if a pipeline is run against that branch, result in exfiltration of group CI/CD variables. -### Instance-level default branch protection +### For all projects in an instance DETAILS: **Tier:** Free, Premium, Ultimate @@ -163,7 +159,7 @@ disable this privilege for group owners, enforcing the protection rule set for t NOTE: GitLab administrators can still update the default branch protection of a group. -### Group-level default branch protection +### For all projects in a group DETAILS: **Tier:** Premium, Ultimate diff --git a/doc/user/project/repository/branches/protected.md b/doc/user/project/repository/branches/protected.md index 1afe1c8c8a6d24ecab57a5d21e6d20625bffe544..da0b3fb32e464d4cb5b33b2f9453869281b2161a 100644 --- a/doc/user/project/repository/branches/protected.md +++ b/doc/user/project/repository/branches/protected.md @@ -83,8 +83,8 @@ that matches `v1.x` must set `Allowed to push and merge` to `No one`, like this: ### Set the default branch protection level -Administrators can set a default branch protection level in the -[**Admin** area](default.md#instance-level-default-branch-protection). +Administrators can [set a default branch protection level](default.md#for-all-projects-in-an-instance) +in the **Admin** area. ## Add protection to existing branches diff --git a/doc/user/project/wiki/_index.md b/doc/user/project/wiki/_index.md index 4ba676073ee25a0187ef04a625227fecab8df2fe..0444176807ce233780bc0025d69dac5203cc5d34 100644 --- a/doc/user/project/wiki/_index.md +++ b/doc/user/project/wiki/_index.md @@ -36,16 +36,9 @@ has [disabled it](#enable-or-disable-a-project-wiki). ## Configure a default branch for your wiki -The default branch for your wiki repository depends on your version of GitLab: - -- *GitLab versions 14.1 and later:* Wikis inherit the - [default branch name](../repository/branches/default.md) configured for - your instance or group. If no custom value is configured, GitLab uses `main`. -- *GitLab versions 14.0 and earlier:* GitLab uses `master`. - -For any version of GitLab, you can -[rename this default branch](../repository/branches/default.md#update-the-default-branch-name-in-your-repository) -for previously created wikis. +Your wiki repository inherits the [default branch name](../repository/branches/default.md) +from your instance or group. If no custom branch name is configured, GitLab uses `main`. +To rename your wiki's default branch,see [Update the default branch name in your repository](../repository/branches/default.md#update-the-default-branch-name-in-your-repository). ## Create the wiki home page diff --git a/ee/app/services/security/security_orchestration_policies/project_create_service.rb b/ee/app/services/security/security_orchestration_policies/project_create_service.rb index bbb469171f00ade2aaa97ec224474c3ae1392efe..6888b96fff704e6dda9124b2399a2880de994c10 100644 --- a/ee/app/services/security/security_orchestration_policies/project_create_service.rb +++ b/ee/app/services/security/security_orchestration_policies/project_create_service.rb @@ -109,7 +109,7 @@ def group_level_branch_protection_docs_link def instance_level_branch_protection_docs_link url_helpers.help_page_url('user/project/repository/branches/default.md', - anchor: 'instance-level-default-branch-protection') + anchor: 'for-all-projects-in-an-instance') end def can_create_projects_in_container? diff --git a/ee/app/views/projects/security/policies/readme.md.tt b/ee/app/views/projects/security/policies/readme.md.tt index 372d3157cbc61b76f6361809d63c0ab573354303..3d3df7ae28f317894c8e0c9d5bdb13acf557d1da 100644 --- a/ee/app/views/projects/security/policies/readme.md.tt +++ b/ee/app/views/projects/security/policies/readme.md.tt @@ -36,6 +36,4 @@ You can read more about the format and policies schema in the [documentation](<% ## Default branch protection settings This project is preconfigured with the default branch set as a protected branch, and only maintainers/owners of -[<%= @container.name %>](<%= @container.web_url %>) have permission to merge into that branch. This overrides any default branch protection both at the -[group level](<%= group_level_branch_protection_docs_link %>) and at the -[instance level](<%= instance_level_branch_protection_docs_link %>). +[<%= @container.name %>](<%= @container.web_url %>) have permission to merge into that branch. This overrides any default branch protection both [for the group](<%= group_level_branch_protection_docs_link %>) and [for the instance](<%= instance_level_branch_protection_docs_link %>). diff --git a/ee/spec/fixtures/projects/security/policies/expected_readme_for_group.md b/ee/spec/fixtures/projects/security/policies/expected_readme_for_group.md index 4597c9108544214d6e46043f4398e182e78dbed5..a2794bd9b78d054d7887502bb0aea59c93493cbd 100644 --- a/ee/spec/fixtures/projects/security/policies/expected_readme_for_group.md +++ b/ee/spec/fixtures/projects/security/policies/expected_readme_for_group.md @@ -36,6 +36,4 @@ You can read more about the format and policies schema in the [documentation](ht ## Default branch protection settings This project is preconfigured with the default branch set as a protected branch, and only maintainers/owners of -[Target Group](http://localhost/groups/target-group) have permission to merge into that branch. This overrides any default branch protection both at the -[group level](http://localhost/help/user/group/manage.md#change-the-default-branch-protection-of-a-group) and at the -[instance level](http://localhost/help/user/project/repository/branches/default.md#instance-level-default-branch-protection). +[Target Group](http://localhost/groups/target-group) have permission to merge into that branch. This overrides any default branch protection both [for the group](http://localhost/help/user/group/manage.md#change-the-default-branch-protection-of-a-group) and [for the instance](http://localhost/help/user/project/repository/branches/default.md#for-all-projects-in-an-instance). diff --git a/ee/spec/fixtures/projects/security/policies/expected_readme_for_project.md b/ee/spec/fixtures/projects/security/policies/expected_readme_for_project.md index 613e75c2890f94db6e3510cdbc793d8379715bfc..28a8ee25e76e1238d595514a3822d5c50718a363 100644 --- a/ee/spec/fixtures/projects/security/policies/expected_readme_for_project.md +++ b/ee/spec/fixtures/projects/security/policies/expected_readme_for_project.md @@ -36,6 +36,4 @@ You can read more about the format and policies schema in the [documentation](ht ## Default branch protection settings This project is preconfigured with the default branch set as a protected branch, and only maintainers/owners of -[Target Project](http://localhost/target-group/target-project) have permission to merge into that branch. This overrides any default branch protection both at the -[group level](http://localhost/help/user/group/manage.md#change-the-default-branch-protection-of-a-group) and at the -[instance level](http://localhost/help/user/project/repository/branches/default.md#instance-level-default-branch-protection). +[Target Project](http://localhost/target-group/target-project) have permission to merge into that branch. This overrides any default branch protection both [for the group](http://localhost/help/user/group/manage.md#change-the-default-branch-protection-of-a-group) and [for the instance](http://localhost/help/user/project/repository/branches/default.md#for-all-projects-in-an-instance).