1、Gitlab查看用户id号的方法
通过api接口查询
接口查询地址: http://10.36.192.142/api/v4/users?username=root
[
{
"id": 1,
"username": "root",
"name": "Administrator",
"state": "active",
"locked": false,
"avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"web_url": "http://10.36.192.142/root"
}
]
2、在命令行修改root用户密码
[root@localhost ~]# gitlab-rails console
--------------------------------------------------------------------------------
Ruby: ruby 3.0.6p216 (2023-03-30 revision 23a532679b) [x86_64-linux]
GitLab: 16.5.2-jh (351502d481d) EE
GitLab Shell: 14.29.0
PostgreSQL: 13.11
------------------------------------------------------------[ booted in 95.62s ]
Loading production environment (Rails 7.0.8)
irb(main):001:0> root = User.where(id: 1).first # id为1的是超级管理员
=> #<User id:1 @root>
irb(main):002:0> root.password = 'll123456' # 密码必须至少8个字符
=> "ll123456"
irb(main):009:0> root.save! # 如没有问题 返回true
=> true
irb(main):010:0> # 退出