GitLab 重置管理员密码
1)登录 GitLab 的 Rails 控制台
| $ docker exec -it gitlab-ce gitlab-rails console
--------------------------------------------------------------------------------
Ruby: ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c5) [x86_64-linux]
GitLab: 15.10.0 (496a1d765be) FOSS
GitLab Shell: 14.18.0
PostgreSQL: 13.8
------------------------------------------------------------[ booted in 31.00s ]
Loading production environment (Rails 6.1.7.2)
irb(main):001:0>
|
2)查询 GitLab 超级管理员信息,查询 id 为 1 的用户对象
| irb(main):001:0> user = User.where(id:1).first
=> #<User id:1 @root>
irb(main):002:0>
|
3)将管理员账号的密码进行重置为新密码,并保存设置
| irb(main):002:0> user.password='Abc12345678'
=> "Abc12345678"
irb(main):003:0> user.save!
=> true
irb(main):004:0> exit
|