# Subgroups
> 原文:[https://docs.gitlab.com/ee/user/group/subgroups/](https://docs.gitlab.com/ee/user/group/subgroups/)
* [Overview](#overview)
* [Creating a subgroup](#creating-a-subgroup)
* [Membership](#membership)
* [Overriding the ancestor group membership](#overriding-the-ancestor-group-membership)
* [Mentioning subgroups](#mentioning-subgroups)
* [Limitations](#limitations)
# Subgroups[](#subgroups "Permalink")
在 GitLab 9.0 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/2772) .
GitLab 支持多达 20 个级别的子组,也称为嵌套组或层次结构组. 组的级别.
通过使用子组,您可以执行以下操作:
* **独立的内部/外部组织.** 由于每个组都有自己的可见性级别,因此您可以在同一保护范围内为不同目的托管组.
* **组织大型项目.** 对于大型项目,子组可能会更容易分隔部分源代码的权限.
* **使管理人员和控制可见性变得更加容易.** 根据人们的组[成员身份,](#membership)赋予他们不同的[权限](../../permissions.html#group-members-permissions) .
有关组和项目中允许的权限的更多信息,请参见[可见性级别](../../../development/permissions.html#general-permissions) .
## Overview[](#overview "Permalink")
一个组中可以有许多子组,而同一组中只能有一个直接父组. 它类似于目录行为或嵌套项目列表:
* 第一组
* 1.1 组
* 1.2 组
* 1.2.1 组
* 1.2.2 组
* 组 1.2.2.1
在一个真实的示例中,设想维护一个 GNU / Linux 发行版,其中第一个组是发行版的名称,随后的组按如下所示拆分:
* Organization Group - GNU/Linux distro
* 类别子组-包
* (项目)配套 01
* (项目)配套 02
* 类别子组-软件
* (项目)核心
* (项目)CLI
* (项目)Android 应用
* (项目)iOS 应用
* 类别子组-红外线工具
* (项目)Ansible 剧本
Another example of GitLab as a company would be the following:
* 组织组-GitLab
* 类别子组-市场营销
* (项目)设计
* (项目)一般
* 类别子组-软件
* (项目)GitLab CE
* (项目)GitLab EE
* (项目)Omnibus GitLab
* (项目)GitLab Runner
* (项目)GitLab Pages 守护程序
* 类别子组-红外线工具
* (项目)厨师食谱
* 类别子组-执行团队
* * *
当执行诸如在子组之间转移或导入项目的操作时,其行为与在`group/project`级别执行这些操作时的行为相同.
## Creating a subgroup[](#creating-a-subgroup "Permalink")
要创建子组,您必须是该组的所有者或维护者,具体取决于该组的设置.
默认情况下,在以下位置创建的组:
* GitLab 12.2 或更高版本允许所有者和维护者创建子组.
* GitLab 12.1 或更早版本仅允许所有者创建子组.
此设置可以是所有者或管理员的任何组.
有关更多信息,请检查[权限表](../../permissions.html#group-members-permissions) . 有关不允许用作组名的单词列表,请参见[保留名称](../../reserved_names.html) .
如果将子组明确地作为所有者(或维护者,如果启用了此设置)添加到直接父组,则用户始终可以创建子组,即使管理员在其设置中禁用了组创建也是如此.
要创建一个子组:
1. 在组的仪表板中,展开" **新建项目**拆分"按钮,选择" **新建子组"** ,然后单击" **新建子组"**按钮.
[![Subgroups page](https://img.kancloud.cn/b2/bd/b2bddf24609c266004fab4a95da82977_1860x375.png)](img/create_subgroup_button.png)
2. 像平常一样创建一个新组. 请注意,直接父组名称空间在" **组路径"**下是固定的. 可见性级别可以与直接父组不同.
[![Subgroups page](https://img.kancloud.cn/70/19/70191e80e89393c2ec2ddc994ee22528_798x648.png)](img/create_new_group.png)
3. 单击**创建组**按钮,您将被带到新组的仪表板页面.
按照相同的过程创建任何后续组.
## Membership[](#membership "Permalink")
将成员添加到子组时,它们将从父组继承成员资格和权限级别. 如果您是其父级成员之一,则该模型允许访问嵌套组.
在亚组可以用乔布斯的管道[运动员](../../../ci/runners/README.html)注册到父组(S). 这意味着为父组配置的机密可用于子组作业.
此外,属于子组的项目的维护者可以查看注册到父组的 Runner 的详细信息.
成员的组权限只能由所有者更改,并且只能在添加成员的组的" **成员"**页面上进行.
您可以通过查看组的" **成员"**页面来确定成员是否从父组继承了权限.
[![Group members page](https://img.kancloud.cn/2d/c4/2dc4f53c34181f4504aa255ba71dd391_1028x368.png)](img/group_members.png)
从上图可以得出以下几点:
* 有 5 位成员可以访问第`four`组.
* User0 是一个 Reporter,已从组`four`的层次结构上方的组`one`继承了其权限.
* 用户 1 是一个开发并已继承组他们的权限`one/two`其是组的层级以上`four` .
* 用户 2 是一个开发并已继承组他们的权限`one/two/three`这是组的层级以上`four` .
* 对于 User3,没有任何父组的指示,因此它们属于`four`组,即我们正在检查的组.
* 管理员是**所有**子组的所有者和成员,因此,与 User3 一样,没有任何祖先组的迹象.
[在](https://gitlab.com/gitlab-org/gitlab/-/issues/21727) GitLab 12.6 中,您可以使用右侧的下拉列表过滤此列表:
[![Group members filter](https://img.kancloud.cn/77/59/7759ca6189a2eae7b978516de10aee2b_253x369.png)](img/group_members_filter_v12_6.png)
* **仅显示直接成员**仅显示 Administrator 和 User3,因为这是属于`four`组的唯一用户,这是我们正在检查的用户.
* **仅显示继承的成员将**显示 User0,User1 和 User2,无论层次结构上方的哪个组都是继承权限的来源.
### Overriding the ancestor group membership[](#overriding-the-ancestor-group-membership "Permalink")
**注意:**您必须是网上论坛的所有者,才能向其中添加成员.**注意:**子组中的用户权限不能低于其任何祖先组中的权限. 因此,您不能针对子组的祖先组减少用户的权限.
要覆盖用户的祖先组(他们被添加到的第一个组)的成员资格,请将该用户再次以更高的权限集添加到新的子组中.
例如,如果首先使用具有开发者权限将 User0 添加到组`group-1/group-1-1` ,则它们将在组`group-1/group-1-1`每个其他子`group-1/group-1-1`继承这些权限. 要为他们提供维护者访问`group-1/group-1-1/group1-1-1` ,您可以将他们再次添加为该维护者. 从该组中删除它们,权限将回退到祖先组的权限.
## Mentioning subgroups[](#mentioning-subgroups "Permalink")
在问题,提交和合并请求中提及组( `@group` )将通知该组的所有成员. 现在有了子组,如果您想拆分组的结构,将有更精细的支持. 提及方式与以前一样,您可以选择要通知的人群.
[![Mentioning subgroups](https://img.kancloud.cn/dd/88/dd8831378048676063af35e26ece517e_500x305.png)](img/mention_subgroups.png)
## Limitations[](#limitations "Permalink")
以下是您无法对子组进行操作的列表:
* [GitLab 页面](../../project/pages/index.html)支持在一个子组下托管的项目,但不支持子组网站下的项目. 这意味着,尽管您可以在子组下拥有项目网站,但是只有最高级别的组才支持[组网站](../../project/pages/getting_started_part_one.html#gitlab-pages-default-domain-names) .
* 不能与作为该项目所属组的祖先的组共享项目.这意味着您只能在沿层次结构走时共享. 例如, `group/subgroup01/project` **不能**与`group`共享,但是可以与`group/subgroup02`或`group/subgroup01/subgroup03`共享.
- GitLab Docs
- Installation
- Requirements
- GitLab cloud native Helm Chart
- Install GitLab with Docker
- Installation from source
- Install GitLab on Microsoft Azure
- Installing GitLab on Google Cloud Platform
- Installing GitLab on Amazon Web Services (AWS)
- Analytics
- Code Review Analytics
- Productivity Analytics
- Value Stream Analytics
- Kubernetes clusters
- Adding and removing Kubernetes clusters
- Adding EKS clusters
- Adding GKE clusters
- Group-level Kubernetes clusters
- Instance-level Kubernetes clusters
- Canary Deployments
- Cluster Environments
- Deploy Boards
- GitLab Managed Apps
- Crossplane configuration
- Cluster management project (alpha)
- Kubernetes Logs
- Runbooks
- Serverless
- Deploying AWS Lambda function using GitLab CI/CD
- Securing your deployed applications
- Groups
- Contribution Analytics
- Custom group-level project templates
- Epics
- Manage epics
- Group Import/Export
- Insights
- Issues Analytics
- Iterations
- Public access
- SAML SSO for GitLab.com groups
- SCIM provisioning using SAML SSO for GitLab.com groups
- Subgroups
- Roadmap
- Projects
- GitLab Secure
- Security Configuration
- Container Scanning
- Dependency Scanning
- Dependency List
- Static Application Security Testing (SAST)
- Secret Detection
- Dynamic Application Security Testing (DAST)
- GitLab Security Dashboard
- Offline environments
- Standalone Vulnerability pages
- Security scanner integration
- Badges
- Bulk editing issues and merge requests at the project level
- Code Owners
- Compliance
- License Compliance
- Compliance Dashboard
- Create a project
- Description templates
- Deploy Keys
- Deploy Tokens
- File finder
- Project integrations
- Integrations
- Atlassian Bamboo CI Service
- Bugzilla Service
- Custom Issue Tracker service
- Discord Notifications service
- Enabling emails on push
- GitHub project integration
- Hangouts Chat service
- Atlassian HipChat
- Irker IRC Gateway
- GitLab Jira integration
- Mattermost Notifications Service
- Mattermost slash commands
- Microsoft Teams service
- Mock CI Service
- Prometheus integration
- Redmine Service
- Slack Notifications Service
- Slack slash commands
- GitLab Slack application
- Webhooks
- YouTrack Service
- Insights
- Issues
- Crosslinking Issues
- Design Management
- Confidential issues
- Due dates
- Issue Boards
- Issue Data and Actions
- Labels
- Managing issues
- Milestones
- Multiple Assignees for Issues
- Related issues
- Service Desk
- Sorting and ordering issue lists
- Issue weight
- Associate a Zoom meeting with an issue
- Merge requests
- Allow collaboration on merge requests across forks
- Merge Request Approvals
- Browser Performance Testing
- How to create a merge request
- Cherry-pick changes
- Code Quality
- Load Performance Testing
- Merge Request dependencies
- Fast-forward merge requests
- Merge when pipeline succeeds
- Merge request conflict resolution
- Reverting changes
- Reviewing and managing merge requests
- Squash and merge
- Merge requests versions
- Draft merge requests
- Members of a project
- Migrating projects to a GitLab instance
- Import your project from Bitbucket Cloud to GitLab
- Import your project from Bitbucket Server to GitLab
- Migrating from ClearCase
- Migrating from CVS
- Import your project from FogBugz to GitLab
- Gemnasium
- Import your project from GitHub to GitLab
- Project importing from GitLab.com to your private GitLab instance
- Import your project from Gitea to GitLab
- Import your Jira project issues to GitLab
- Migrating from Perforce Helix
- Import Phabricator tasks into a GitLab project
- Import multiple repositories by uploading a manifest file
- Import project from repo by URL
- Migrating from SVN to GitLab
- Migrating from TFVC to Git
- Push Options
- Releases
- Repository
- Branches
- Git Attributes
- File Locking
- Git file blame
- Git file history
- Repository mirroring
- Protected branches
- Protected tags
- Push Rules
- Reduce repository size
- Signing commits with GPG
- Syntax Highlighting
- GitLab Web Editor
- Web IDE
- Requirements Management
- Project settings
- Project import/export
- Project access tokens (Alpha)
- Share Projects with other Groups
- Snippets
- Static Site Editor
- Wiki
- Project operations
- Monitor metrics for your CI/CD environment
- Set up alerts for Prometheus metrics
- Embedding metric charts within GitLab-flavored Markdown
- Embedding Grafana charts
- Using the Metrics Dashboard
- Dashboard YAML properties
- Metrics dashboard settings
- Panel types for dashboards
- Using Variables
- Templating variables for metrics dashboards
- Prometheus Metrics library
- Monitoring AWS Resources
- Monitoring HAProxy
- Monitoring Kubernetes
- Monitoring NGINX
- Monitoring NGINX Ingress Controller
- Monitoring NGINX Ingress Controller with VTS metrics
- Alert Management
- Error Tracking
- Tracing
- Incident Management
- GitLab Status Page
- Feature Flags
- GitLab CI/CD
- GitLab CI/CD pipeline configuration reference
- GitLab CI/CD include examples
- Introduction to CI/CD with GitLab
- Getting started with GitLab CI/CD
- How to enable or disable GitLab CI/CD
- Using SSH keys with GitLab CI/CD
- Migrating from CircleCI
- Migrating from Jenkins
- Auto DevOps
- Getting started with Auto DevOps
- Requirements for Auto DevOps
- Customizing Auto DevOps
- Stages of Auto DevOps
- Upgrading PostgreSQL for Auto DevOps
- Cache dependencies in GitLab CI/CD
- GitLab ChatOps
- Cloud deployment
- Docker integration
- Building Docker images with GitLab CI/CD
- Using Docker images
- Building images with kaniko and GitLab CI/CD
- GitLab CI/CD environment variables
- Predefined environment variables reference
- Where variables can be used
- Deprecated GitLab CI/CD variables
- Environments and deployments
- Protected Environments
- GitLab CI/CD Examples
- Test a Clojure application with GitLab CI/CD
- Using Dpl as deployment tool
- Testing a Phoenix application with GitLab CI/CD
- End-to-end testing with GitLab CI/CD and WebdriverIO
- DevOps and Game Dev with GitLab CI/CD
- Deploy a Spring Boot application to Cloud Foundry with GitLab CI/CD
- How to deploy Maven projects to Artifactory with GitLab CI/CD
- Testing PHP projects
- Running Composer and NPM scripts with deployment via SCP in GitLab CI/CD
- Test and deploy Laravel applications with GitLab CI/CD and Envoy
- Test and deploy a Python application with GitLab CI/CD
- Test and deploy a Ruby application with GitLab CI/CD
- Test and deploy a Scala application to Heroku
- GitLab CI/CD for external repositories
- Using GitLab CI/CD with a Bitbucket Cloud repository
- Using GitLab CI/CD with a GitHub repository
- GitLab Pages
- GitLab Pages
- GitLab Pages domain names, URLs, and baseurls
- Create a GitLab Pages website from scratch
- Custom domains and SSL/TLS Certificates
- GitLab Pages integration with Let's Encrypt
- GitLab Pages Access Control
- Exploring GitLab Pages
- Incremental Rollouts with GitLab CI/CD
- Interactive Web Terminals
- Optimizing GitLab for large repositories
- Metrics Reports
- CI/CD pipelines
- Pipeline Architecture
- Directed Acyclic Graph
- Multi-project pipelines
- Parent-child pipelines
- Pipelines for Merge Requests
- Pipelines for Merged Results
- Merge Trains
- Job artifacts
- Pipeline schedules
- Pipeline settings
- Triggering pipelines through the API
- Review Apps
- Configuring GitLab Runners
- GitLab CI services examples
- Using MySQL
- Using PostgreSQL
- Using Redis
- Troubleshooting CI/CD
- GitLab Package Registry
- GitLab Container Registry
- Dependency Proxy
- GitLab Composer Repository
- GitLab Conan Repository
- GitLab Maven Repository
- GitLab NPM Registry
- GitLab NuGet Repository
- GitLab PyPi Repository
- API Docs
- API resources
- .gitignore API
- GitLab CI YMLs API
- Group and project access requests API
- Appearance API
- Applications API
- Audit Events API
- Avatar API
- Award Emoji API
- Project badges API
- Group badges API
- Branches API
- Broadcast Messages API
- Project clusters API
- Group clusters API
- Instance clusters API
- Commits API
- Container Registry API
- Custom Attributes API
- Dashboard annotations API
- Dependencies API
- Deploy Keys API
- Deployments API
- Discussions API
- Dockerfiles API
- Environments API
- Epics API
- Events
- Feature Flags API
- Feature flag user lists API
- Freeze Periods API
- Geo Nodes API
- Group Activity Analytics API
- Groups API
- Import API
- Issue Boards API
- Group Issue Boards API
- Issues API
- Epic Issues API
- Issues Statistics API
- Jobs API
- Keys API
- Labels API
- Group Labels API
- License
- Licenses API
- Issue links API
- Epic Links API
- Managed Licenses API
- Markdown API
- Group and project members API
- Merge request approvals API
- Merge requests API
- Project milestones API
- Group milestones API
- Namespaces API
- Notes API
- Notification settings API
- Packages API
- Pages domains API
- Pipeline schedules API
- Pipeline triggers API
- Pipelines API
- Project Aliases API
- Project import/export API
- Project repository storage moves API
- Project statistics API
- Project templates API
- Projects API
- Protected branches API
- Protected tags API
- Releases API
- Release links API
- Repositories API
- Repository files API
- Repository submodules API
- Resource label events API
- Resource milestone events API
- Resource weight events API
- Runners API
- SCIM API
- Search API
- Services API
- Application settings API
- Sidekiq Metrics API
- Snippets API
- Project snippets
- Application statistics API
- Suggest Changes API
- System hooks API
- Tags API
- Todos API
- Users API
- Project-level Variables API
- Group-level Variables API
- Version API
- Vulnerabilities API
- Vulnerability Findings API
- Wikis API
- GraphQL API
- Getting started with GitLab GraphQL API
- GraphQL API Resources
- API V3 to API V4
- Validate the .gitlab-ci.yml (API)
- User Docs
- Abuse reports
- User account
- Active sessions
- Deleting a User account
- Permissions
- Personal access tokens
- Profile preferences
- Threads
- GitLab and SSH keys
- GitLab integrations
- Git
- GitLab.com settings
- Infrastructure as code with Terraform and GitLab
- GitLab keyboard shortcuts
- GitLab Markdown
- AsciiDoc
- GitLab Notification Emails
- GitLab Quick Actions
- Autocomplete characters
- Reserved project and group names
- Search through GitLab
- Advanced Global Search
- Advanced Syntax Search
- Time Tracking
- GitLab To-Do List
- Administrator Docs
- Reference architectures
- Reference architecture: up to 1,000 users
- Reference architecture: up to 2,000 users
- Reference architecture: up to 3,000 users
- Reference architecture: up to 5,000 users
- Reference architecture: up to 10,000 users
- Reference architecture: up to 25,000 users
- Reference architecture: up to 50,000 users
- Troubleshooting a reference architecture set up
- Working with the bundled Consul service
- Configuring PostgreSQL for scaling
- Configuring GitLab application (Rails)
- Load Balancer for multi-node GitLab
- Configuring a Monitoring node for Scaling and High Availability
- NFS
- Working with the bundled PgBouncer service
- Configuring Redis for scaling
- Configuring Sidekiq
- Admin Area settings
- Continuous Integration and Deployment Admin settings
- Custom instance-level project templates
- Diff limits administration
- Enable and disable GitLab features deployed behind feature flags
- Geo nodes Admin Area
- GitLab Pages administration
- Health Check
- Job logs
- Labels administration
- Log system
- PlantUML & GitLab
- Repository checks
- Repository storage paths
- Repository storage types
- Account and limit settings
- Service templates
- System hooks
- Changing your time zone
- Uploads administration
- Abuse reports
- Activating and deactivating users
- Audit Events
- Blocking and unblocking users
- Broadcast Messages
- Elasticsearch integration
- Gitaly
- Gitaly Cluster
- Gitaly reference
- Monitoring GitLab
- Monitoring GitLab with Prometheus
- Performance Bar
- Usage statistics
- Object Storage
- Performing Operations in GitLab
- Cleaning up stale Redis sessions
- Fast lookup of authorized SSH keys in the database
- Filesystem Performance Benchmarking
- Moving repositories managed by GitLab
- Run multiple Sidekiq processes
- Sidekiq MemoryKiller
- Switching to Puma
- Understanding Unicorn and unicorn-worker-killer
- User lookup via OpenSSH's AuthorizedPrincipalsCommand
- GitLab Package Registry administration
- GitLab Container Registry administration
- Replication (Geo)
- Geo database replication
- Geo with external PostgreSQL instances
- Geo configuration
- Using a Geo Server
- Updating the Geo nodes
- Geo with Object storage
- Docker Registry for a secondary node
- Geo for multiple nodes
- Geo security review (Q&A)
- Location-aware Git remote URL with AWS Route53
- Tuning Geo
- Removing secondary Geo nodes
- Geo data types support
- Geo Frequently Asked Questions
- Geo Troubleshooting
- Geo validation tests
- Disaster Recovery (Geo)
- Disaster recovery for planned failover
- Bring a demoted primary node back online
- Automatic background verification
- Rake tasks
- Back up and restore GitLab
- Clean up
- Namespaces
- Maintenance Rake tasks
- Geo Rake Tasks
- GitHub import
- Import bare repositories
- Integrity check Rake task
- LDAP Rake tasks
- Listing repository directories
- Praefect Rake tasks
- Project import/export administration
- Repository storage Rake tasks
- Generate sample Prometheus data
- Uploads migrate Rake tasks
- Uploads sanitize Rake tasks
- User management
- Webhooks administration
- X.509 signatures
- Server hooks
- Static objects external storage
- Updating GitLab
- GitLab release and maintenance policy
- Security
- Password Storage
- Custom password length limits
- Restrict allowed SSH key technologies and minimum length
- Rate limits
- Webhooks and insecure internal web services
- Information exclusivity
- How to reset your root password
- How to unlock a locked user from the command line
- User File Uploads
- How we manage the TLS protocol CRIME vulnerability
- User email confirmation at sign-up
- Security of running jobs
- Proxying assets
- CI/CD Environment Variables
- Contributor and Development Docs
- Contribute to GitLab
- Community members & roles
- Implement design & UI elements
- Issues workflow
- Merge requests workflow
- Code Review Guidelines
- Style guides
- GitLab Architecture Overview
- CI/CD development documentation
- Database guides
- Database Review Guidelines
- Database Review Guidelines
- Migration Style Guide
- What requires downtime?
- Understanding EXPLAIN plans
- Rake tasks for developers
- Mass inserting Rails models
- GitLab Documentation guidelines
- Documentation Style Guide
- Documentation structure and template
- Documentation process
- Documentation site architecture
- Global navigation
- GitLab Docs monthly release process
- Telemetry Guide
- Usage Ping Guide
- Snowplow Guide
- Experiment Guide
- Feature flags in development of GitLab
- Feature flags process
- Developing with feature flags
- Feature flag controls
- Document features deployed behind feature flags
- Frontend Development Guidelines
- Accessibility & Readability
- Ajax
- Architecture
- Axios
- Design Patterns
- Frontend Development Process
- DropLab
- Emojis
- Filter
- Frontend FAQ
- GraphQL
- Icons and SVG Illustrations
- InputSetter
- Performance
- Principles
- Security
- Tooling
- Vuex
- Vue
- Geo (development)
- Geo self-service framework (alpha)
- Gitaly developers guide
- GitLab development style guides
- API style guide
- Go standards and style guidelines
- GraphQL API style guide
- Guidelines for shell commands in the GitLab codebase
- HTML style guide
- JavaScript style guide
- Migration Style Guide
- Newlines style guide
- Python Development Guidelines
- SCSS style guide
- Shell scripting standards and style guidelines
- Sidekiq debugging
- Sidekiq Style Guide
- SQL Query Guidelines
- Vue.js style guide
- Instrumenting Ruby code
- Testing standards and style guidelines
- Flaky tests
- Frontend testing standards and style guidelines
- GitLab tests in the Continuous Integration (CI) context
- Review Apps
- Smoke Tests
- Testing best practices
- Testing levels
- Testing Rails migrations at GitLab
- Testing Rake tasks
- End-to-end Testing
- Beginner's guide to writing end-to-end tests
- End-to-end testing Best Practices
- Dynamic Element Validation
- Flows in GitLab QA
- Page objects in GitLab QA
- Resource class in GitLab QA
- Style guide for writing end-to-end tests
- Testing with feature flags
- Translate GitLab to your language
- Internationalization for GitLab
- Translating GitLab
- Proofread Translations
- Merging translations from CrowdIn
- Value Stream Analytics development guide
- GitLab subscription
- Activate GitLab EE with a license