参考有效:?https://blog.csdn.net/goodlook0123/article/details/82383586
docker 安装gitlab的时候,忘记root密码。?
如何初始化密码
执行以下四个步骤
gitlab-rails console
user = User.where(username: ‘root’).first
user.password = ‘password’
user.save!
[root@localhost tools]# docker exec -it 111fa7bd0e56 /bin/bash
root@gitlab:/#
root@gitlab:/#
root@gitlab:/# gitlab-rails console
--------------------------------------------------------------------------------
Ruby: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
GitLab: 14.0.5 (25fc1060aff) FOSS
GitLab Shell: 13.19.0
PostgreSQL: 12.6
--------------------------------------------------------------------------------
Loading production environment (Rails 6.1.3.2)
irb(main):001:0>
irb(main):002:0> user = User.where(username: 'root').first
=> #<User id:1 @root>
irb(main):003:0> user.password = 'zhangsan'
=> "zhangsan"
irb(main):004:0> user.save!
Enqueued ActionMailer::MailDeliveryJob (Job ID: 56667f8d-3dea-406d-913b-dd67827515ff) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", {:args=>[#<GlobalID:0x00007f6f64de5640 @uri=#<URI::GID gid://gitlab/User/1>>]}
=> true
irb(main):005:0>
执行? ctrl+d 退出
|