首先连接到gitlab服务器,然后连接到gitlab终端:
gitlab-rails console -e production
等待连接完成,连接完成后设置user为root账户
user = User.where(id: 1).first
设置成功后我们就可以设置新的密码了
irb(main):005:0> user.password = 'newpassowrd'
=> "newpassowrd"
irb(main):006:0> user.password_confirmation = 'newpassowrd'
=> "newpassowrd"
设置完成后就可以保存退出了
irb(main):007:0> user.save!
Enqueued ActionMailer::DeliveryJob (Job ID: 8cc5ffc4-0455-4e3c-8be7-f28c159eaaa8) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", #<GlobalID:0x00007f51972327c0 @uri=#<URI::GID gid://gitlab/User/1>>
=> true
irb(main):008:0> quit
现在就可以用新密码登录了!
Comments NOTHING