解决:
gitlab-ctl start?保证gitlab处于启动状态,&保证redis处于启动状态
gitlab-rails console production?进入gitlab串口环境下
irb(main):001:0>user = User.where(id: 1).first?定位到gitlab?数据库中Users表中的一个用户,通常就是管理员用户admin@local.host
irb(main):002:0> user.password=12345678? ?重置管理员密码为12345678
irb(main):003:0> user.password_confirmation=12345678? ?确认管理员密码为12345678
irb(main):004:0> user.save!? ? 保存更改信息
# su - git
-sh-4.2$ gitlab-rails console production
-------------------------------------------------------------------------------------
GitLab: 12.0.3 (08a51a9db93)
GitLab Shell: 9.3.0
PostgreSQL: 10.7
-------------------------------------------------------------------------------------
Loading production environment (Rails 5.1.7)
irb(main):001:0> user = User.where(id: 1).first
=> #<User id:1 @root>
irb(main):004:0> user.password=12345678
=> 12345678
irb(main):005:0> user.save!
Enqueued ActionMailer::DeliveryJob (Job ID: 60439440-6443-46d1-acda-e29172be146a) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", #<GlobalID:0x00007f09e949b958 @uri=#<URI::GID gid://gitlab/User/1>>
=> true
irb(main):006:0> exit
-sh-4.2$ exit
[root@qas-k8s-gitlab gitlab]# gitlab-ctl restart
ok: run: alertmanager: (pid 43507) 0s
ok: run: gitaly: (pid 43523) 0s
ok: run: gitlab-monitor: (pid 43542) 1s
ok: run: gitlab-workhorse: (pid 43550) 0s
ok: run: grafana: (pid 43563) 1s
ok: run: logrotate: (pid 43576) 0s
ok: run: nginx: (pid 43659) 1s
ok: run: node-exporter: (pid 43665) 0s
ok: run: postgres-exporter: (pid 43671) 0s
ok: run: postgresql: (pid 43680) 1s
ok: run: prometheus: (pid 43690) 0s
ok: run: redis: (pid 43701) 1s
ok: run: redis-exporter: (pid 43705) 0s
ok: run: sidekiq: (pid 43715) 0s
ok: run: unicorn: (pid 43726) 1s
原文:https://blog.51cto.com/10880347/2426529