记一次忘记GitLab管理员的密码忘记重置

时间:2022-01-23 16:57:57
Docker ps

先找出容器 

docker exec -it gitlab_web_1 bash

进入命令行环境

cd bin //进入bin目录

root@192:/bin# gitlab-rails console production
-------------------------------------------------------------------------------------
 GitLab:       11.1.4 (63daf37)
 GitLab Shell: 7.1.4
 postgresql:   9.6.8
-------------------------------------------------------------------------------------
Loading production environment (Rails 4.2.10)
irb(main):001:0> user=User.where(id:1).first
=> #<User id:1 @root>
irb(main):002:0> user.password='12345678'  //重置密码
=> "12345678"
irb(main):004:0> user.password_confirmation='12345678'
=> "12345678"
irb(main):005:0> user.save!
Enqueued ActionMailer::DeliveryJob (Job ID: ff062b24-0b10-4f10-8627-f6c762a82846) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", gid://gitlab/User/1
=> true
irb(main):006:0>