code.gitea.io/gitea@v1.22.3/docs/content/usage/protected-tags.en-us.md (about)

     1  ---
     2  date: "2021-05-14T00:00:00-00:00"
     3  title: "Protected tags"
     4  slug: "protected-tags"
     5  sidebar_position: 45
     6  toc: false
     7  draft: false
     8  aliases:
     9    - /en-us/protected-tags
    10  menu:
    11    sidebar:
    12      parent: "usage"
    13      name: "Protected tags"
    14      sidebar_position: 45
    15      identifier: "protected-tags"
    16  ---
    17  
    18  # Protected tags
    19  
    20  Protected tags allow control over who has permission to create or update Git tags. Each rule allows you to match either an individual tag name, or use an appropriate pattern to control multiple tags at once.
    21  
    22  ## Setting up protected tags
    23  
    24  To protect a tag, you need to follow these steps:
    25  
    26  1. Go to the repository’s **Settings** > **Tags** page.
    27  1. Type a pattern to match a name. You can use a single name, a [glob pattern](https://pkg.go.dev/github.com/gobwas/glob#Compile) or a regular expression.
    28  1. Choose the allowed users and/or teams. If you leave these fields empty no one is allowed to create or modify this tag.
    29  1. Select **Save** to save the configuration.
    30  
    31  ## Pattern protected tags
    32  
    33  The pattern uses [glob](https://pkg.go.dev/github.com/gobwas/glob#Compile) or regular expressions to match a tag name. For regular expressions you need to enclose the pattern in slashes.
    34  
    35  Examples:
    36  
    37  | Type  | Pattern Protected Tag    | Possible Matching Tags                  |
    38  | ----- | ------------------------ | --------------------------------------- |
    39  | Glob  | `v*`                     | `v`, `v-1`, `version2`                  |
    40  | Glob  | `v[0-9]`                 | `v0`, `v1` up to `v9`                   |
    41  | Glob  | `*-release`              | `2.1-release`, `final-release`          |
    42  | Glob  | `gitea`                  | only `gitea`                            |
    43  | Glob  | `*gitea*`                | `gitea`, `2.1-gitea`, `1_gitea-release` |
    44  | Glob  | `{v,rel}-*`              | `v-`, `v-1`, `v-final`, `rel-`, `rel-x` |
    45  | Glob  | `*`                      | matches all possible tag names          |
    46  | Regex | `/\Av/`                  | `v`, `v-1`, `version2`                  |
    47  | Regex | `/\Av[0-9]\z/`           | `v0`, `v1` up to `v9`                   |
    48  | Regex | `/\Av\d+\.\d+\.\d+\z/`   | `v1.0.17`, `v2.1.0`                     |
    49  | Regex | `/\Av\d+(\.\d+){0,2}\z/` | `v1`, `v2.1`, `v1.2.34`                 |
    50  | Regex | `/-release\z/`           | `2.1-release`, `final-release`          |
    51  | Regex | `/gitea/`                | `gitea`, `2.1-gitea`, `1_gitea-release` |
    52  | Regex | `/\Agitea\z/`            | only `gitea`                            |
    53  | Regex | `/^gitea$/`              | only `gitea`                            |
    54  | Regex | `/\A(v\|rel)-/`          | `v-`, `v-1`, `v-final`, `rel-`, `rel-x` |
    55  | Regex | `/.+/`                   | matches all possible tag names          |