# Repository selection rules

**GitProtect provides selection rules, allowing administrators to determine which repositories and projects are included or excluded from backup and recovery tasks. Rules can be based on names, owners, creation dates, branches, or specific patterns, offering granular control over the backup scope and ensuring that only relevant repositories and projects are processed.**

***

## Selection rules and rule patterns

Below are the selection rules and rule patterns you can use in **GitProtect** to select repositories and projects for inclusion in backup jobs within your **DevOps** organization.

### <mark style="background-color:blue;">Azure DevOps & Bitbucket</mark>

1. **Repository name** — you can use the full or partial name of a repository. Wildcard characters can be used at the end of the rule to match repository names:
   1. `*` matches zero or more characters
   2. `?` matches exactly one character
2. **Project name**: protects all repositories within the specified project.

### <mark style="background-color:blue;">GitHub</mark>

1. **Repository name** — you can use the full or partial name of a repository. Wildcard characters can be used at the end of the rule to match repository names:
   1. `*` matches zero or more characters
   2. `?` matches exactly one character
2. **Topic name** — specify the exact name of a topic. For example, if you enter the topic `html`, all repositories assigned to the `html` topic will be backed up.

### <mark style="background-color:blue;">GitLab</mark>

1. **Repository name** — you can use the full or partial name of a repository. Wildcard characters can be used at the end of the rule to match repository names:
   1. `*` matches zero or more characters
   2. `?` matches exactly one character
2. **Topic name** — specify the exact name of a topic. For example, if you enter the topic `html`, all repositories assigned to the `html` topic will be backed up.
3. **Group path**: protects all repositories within the specified group or subgroup path.

***

## Selection rule examples

The following are examples of rule patterns, along with brief explanations:

* **Pattern:** `yourorganization/*`
  * This will match all repositories in the organization named `yourorganization`.
* **Pattern:** `yourorganization/n??`
  * Matches repositories where `n` is followed by exactly **two characters**.

***

## Regular expression patterns (regex)

All selection rules can use **regular expression patterns** (**regex**).

Regular expressions let you create flexible and adaptable rules that align with your organization's naming conventions. This approach allows precise targeting and automation based on consistent patterns in repository or project names.

The following are illustrative examples of how these rules can be applied, although the available configurations extend well beyond these cases:

* **Pattern:** `yourorganization/repo[0-9]+`
  * This will match repositories such as `repo1`, `repo12`, `repo123`, and so on.
* **Pattern:** `yourorganization/.*data.*`&#x20;
  * Matches any repository name containing the word `data`.
* **Pattern:** `yourorganization/(?!.*data.*)`
  * Excludes any repository name that contains the word `data`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://helpcenter.gitprotect.io/backup-and-recovery/devops/general/repository-selection-rules.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
