你问的“Linux GitLab 如何权限”,一般可以从 系统层面(Linux 服务器) 和 GitLab 应用层面(用户/项目/组权限) 两个角度来看。下面我分别说明,你可以按需查看。
如果你是指 GitLab 安装在 Linux 上,系统用户和目录权限怎么管理:
GitLab 安装后通常会创建系统用户:
cat /etc/passwd | grep git
常见用户:
git:Git 仓库操作用户gitlab-www:Web 服务用户gitlab-redisgitlab-psql⚠️ 不要手动修改 /var/opt/gitlab/git-data 目录权限
GitLab 仓库默认位置:
/var/opt/gitlab/git-data/repositories
正确权限示例:
chown -R git:git /var/opt/gitlab/git-data
gitlab-ctl reconfigure
gitlab-ctl restart
gitlab-ctl status
GitLab 用户分为:
进入项目:
Settings → Members
添加用户并选择角色:
组权限会继承到项目:
Groups → Your Group → Members
适合公司/团队统一管理。
Settings → Repository → Protected Branches
可设置:
main 分支:仅 Maintainer 可 mergedev 分支:Developer 可 push用户自己添加 SSH Key:
User Settings → SSH Keys
使用 Deploy Token 或 Deploy Key
Settings → Repository → Deploy Keys
你可以补充说明:
我可以直接给你命令级或界面级操作方案。