<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # Code Owners > 原文:[https://docs.gitlab.com/ee/user/project/code_owners.html](https://docs.gitlab.com/ee/user/project/code_owners.html) * [Introduction](#introduction) * [Why is this useful?](#why-is-this-useful) * [How to set up Code Owners](#how-to-set-up-code-owners) * [Approvals by Code Owners](#approvals-by-code-owners) * [The syntax of Code Owners files](#the-syntax-of-code-owners-files) # Code Owners[](#code-owners-starter "Permalink") 版本歷史 * 在[GitLab Starter](https://about.gitlab.com/pricing/) 11.3 中[引入](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/6916) . * [支持](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/53182)在 GitLab Starter 12.1 中添加的[組名稱空間](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/53182) . * 在[GitLab Premium](https://about.gitlab.com/pricing/) 11.9 中[引入](https://gitlab.com/gitlab-org/gitlab/-/issues/4418)了用于合并請求批準的代碼所有者. ## Introduction[](#introduction "Permalink") 在為項目做貢獻時,通常很難找出誰應該審查或批準合并請求. 此外,如果您對特定文件或代碼塊有疑問,可能很難知道從誰那里找到答案. GitLab 代碼所有者是一項功能,用于定義誰擁有存儲庫中的特定文件或路徑,從而允許其他用戶了解誰對每個文件或路徑負責. ## Why is this useful?[](#why-is-this-useful "Permalink") 代碼所有者允許使用版本控制的單個真實文件源,該文件概述了擁有存儲庫中某些文件或路徑的確切 GitLab 用戶或組. 可以在合并請求批準過程中利用代碼所有者,該過程可以簡化為給定合并請求找到合適的審閱者和批準者的過程. 在大型組織或流行的開源項目中,如果您遇到的問題可能與代碼審查或合并請求批準無關,則代碼所有者還可以幫助您了解與誰聯系. ## How to set up Code Owners[](#how-to-set-up-code-owners "Permalink") 您可以使用`CODEOWNERS`文件來指定負責存儲庫中某些文件的用戶或[共享組](members/share_project_with_groups.html) . 您可以在三個位置選擇并添加`CODEOWNERS`文件: * 到存儲庫的根目錄 * 在`.gitlab/`目錄中 * 在`docs/`目錄中 The `CODEOWNERS` file is scoped to a branch, which means that with the introduction of new files, the person adding the new content can specify themselves as a code owner, all before the new changes get merged to the default branch. 當一個文件與`CODEOWNERS`文件中的多個條目匹配時,與該文件匹配的上一個模式的用戶將顯示在給定文件的 Blob 頁面上. 例如,您具有以下`CODEOWNERS`文件: ``` README.md @user1 # This line would also match the file README.md *.md @user2 ``` 將顯示`README.md`的用戶為`@user2` . ## Approvals by Code Owners[](#approvals-by-code-owners "Permalink") 將"代碼所有者"設置為項目后,可以將其配置為用于合并請求批準: * As [merge request eligible approvers](merge_requests/merge_request_approvals.html#code-owners-as-eligible-approvers). * 根據需要批準[分支機構](protected_branches.html#protected-branches-approval-by-code-owners-premium) . **注意** :為了批準合并請求,需要開發人員或更高[權限](../permissions.html) . 設置后,"代碼所有者"將顯示在合并請求小部件中: [![MR widget - Code Owners](https://img.kancloud.cn/88/3f/883ffaa93c0a2bbfc65761cb13ea2212_2040x686.png)](img/code_owners_mr_widget_v12_4.png) 盡管`CODEOWNERS`文件除了可以用于合并請求[批準規則之外](merge_requests/merge_request_approvals.html#approval-rules) ,還可以用作合并請求批準的唯一驅動程序(不使用[批準規則](merge_requests/merge_request_approvals.html#approval-rules) ). 為此,請在上面指定的三個位置之一中創建文件,并將代碼所有者設置為[受保護分支的](protected_branches.html#protected-branches-approval-by-code-owners-premium)必需批準者. 使用[代碼所有者文件的語法](code_owners.html#the-syntax-of-code-owners-files)來指定實際所有者和精細權限. 結合使用"代碼所有者"和" [受保護的分支機構批準",](protected_branches.html#protected-branches-approval-by-code-owners-premium)將防止在`CODEOWNERS`文件中未指定的任何用戶推送對指定文件/路徑的更改,即使其角色包含在" **允許推送"**列中. 這允許采用更具包容性的推送策略,因為管理員不必限制開發人員直接將其推送到受保護的分支,而可以將推送限制到某些需要代碼所有者審查的文件. ## The syntax of Code Owners files[](#the-syntax-of-code-owners-files "Permalink") 可以使用與`.gitignore`文件中使用的相同類型的模式來指定文件,然后使用一個或多個用戶的`@username`或電子郵件或應作為文件所有者的一個或多個組的`@name`進行指定. 必須將組添加為[項目的成員](members/index.html) ,否則它們將被忽略. 從[GitLab 13.0](https://gitlab.com/gitlab-org/gitlab/-/issues/32432)開始,您現在可以將項目組層次結構中的組或子組指定為潛在的代碼所有者. 例如,考慮給定項目的以下層次結構: ``` group >> sub-group >> sub-subgroup >> myproject >> file.md ``` 以下任何組都可以被指定為代碼所有者: * `@group` * `@group/sub-group` * `@group/sub-group/sub-subgroup` 此外,使用" **成員"**工具邀請到項目的任何組也將被視為合格的代碼所有者. 定義路徑的順序很重要:與給定路徑匹配的最后一個模式將用于查找代碼所有者. 以`#`開頭的行表示注釋. 需要使用`\#`對其進行轉義,以尋址其名稱以`#`開頭的文件. Example `CODEOWNERS` file: ``` # This is an example of a code owners file # lines starting with a `#` will be ignored. # app/ @commented-rule # We can specify a default match using wildcards: * @default-codeowner # We can also specify "multiple tab or space" separated codeowners: * @multiple @code @owners # Rules defined later in the file take precedence over the rules # defined before. # This will match all files for which the file name ends in `.rb` *.rb @ruby-owner # Files with a `#` can still be accessed by escaping the pound sign \#file_with_pound.rb @owner-file-with-pound # Multiple codeowners can be specified, separated by spaces or tabs # In the following case the CODEOWNERS file from the root of the repo # has 3 code owners (@multiple @code @owners) CODEOWNERS @multiple @code @owners # Both usernames or email addresses can be used to match # users. Everything else will be ignored. For example this will # specify `@legal` and a user with email `janedoe@gitlab.com` as the # owner for the LICENSE file LICENSE @legal this_does_not_match janedoe@gitlab.com # Group names can be used to match groups and nested groups to specify # them as owners for a file README @group @group/with-nested/subgroup # Ending a path in a `/` will specify the code owners for every file # nested in that directory, on any level /docs/ @all-docs # Ending a path in `/*` will specify code owners for every file in # that directory, but not nested deeper. This will match # `docs/index.md` but not `docs/projects/index.md` /docs/* @root-docs # This will make a `lib` directory nested anywhere in the repository # match lib/ @lib-owner # This will only match a `config` directory in the root of the # repository /config/ @config-owner # If the path contains spaces, these need to be escaped like this: path\ with\ spaces/ @space-owner ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看