轉載:https://blog.51cto.com/liqingbiao/2453796
(一)、添加用戶
1、用root管理員登陸,點擊管理區域
2、點擊New User,並輸入相關的信息。
3、點擊確定后輸入相關的密碼
(二)、創建組
1、點擊管理區域,選擇組
2、依次編輯相關的賬號信息
3、編輯組,並添加相應的用戶
可以通過輸入名字選擇要分配權限的小組成員,然后分配角色,選擇權限有效時間,點擊Add to Project就把人員拉近到項目中。GitLab的角色有以下四種:
Guest:可以創建issue、發表評論,不能讀寫版本庫
Reporter:可以克隆代碼,不能提交,可以賦予測試、產品經理此權限
Developer:可以克隆代碼、開發、提交、push,可以賦予開發人員此權限
MainMaster:可以創建項目、添加tag、保護分支、添加項目成員、編輯項目,一般GitLab管理員或者CTO才有此權限
(三)、創建項目並分配相關的權限
1、單擊項目,並創建項目
2、給該項目選擇成員或組,並分配相應的角色。具體如下,進入項目---setting---members---指定用戶或組分配權限和角色----最后添加到項目中。
3、查看相關的權限
后續:強制禁用gitlab的雙因子認證:Two-Factor Authentication,如果不禁用的話,什么都做不成。
具體解決方法如下:
1、查看gitlab安裝時的postgresql的相關信息
[root@otrs004097 ~]# cat /var/opt/gitlab/gitlab-rails/etc/database.yml # This file is managed by gitlab-ctl. Manual changes will be # erased! To change the contents below, edit /etc/gitlab/gitlab.rb # and run `sudo gitlab-ctl reconfigure`. production: adapter: postgresql encoding: unicode collation: database: gitlabhq_production pool: 10 username: "gitlab" password: host: "/var/opt/gitlab/postgresql" port: 5432 socket: sslmode: sslcompression: 0 sslrootcert: sslca: load_balancing: {"hosts":[]} prepared_statements: false statements_limit: 1000 fdw:
2、連接到gitlabhq_production庫
[root@otrs004097 ~]# su - gitlab-psql Last login: Tue Nov 26 15:21:31 CST 2019 on pts/0 -sh-4.2$ psql -h /var/opt/gitlab/postgresql -d gitlabhq_production psql (10.9) Type "help" for help. gitlabhq_production=# \l gitlabhq_production=# SELECT name,username,otp_required_for_login,two_factor_grace_period, require_two_factor_authentication_from_group FROM users; name | username | otp_required_for_login | two_factor_grace_period | require_two_factor_authentication_from_group ---------------+----------+------------------------+-------------------------+---------------------------------------------- yw | yw | f | 48 | f lqb | lqb | f | 48 | t ops | yunwei | f | 48 | f dev | dev1 | f | 48 | f test | test1 | f | 48 | f Administrator | root | f | 48 | f (6 rows) gitlabhq_production=# UPDATE users set require_two_factor_authentication_from_group = 'f' WHERE username = 'root'; UPDATE 1