Gitlab 重置管理员密码
- 当前环境。
0 20:58:10 root@gitlab,172.16.2.6:~ # cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
13.9.3
0 20:58:12 root@gitlab,172.16.2.6:~ # cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
- 重置gitlab管理员密码。
0 20:59:56 root@gitlab,172.16.2.6:~ # gitlab-rails console -e production
--------------------------------------------------------------------------------
Ruby: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
GitLab: 13.9.3 (ea359c58edb) FOSS
GitLab Shell: 13.17.0
PostgreSQL: 12.5
--------------------------------------------------------------------------------
Loading production environment (Rails 6.0.3.4)
irb(main):001:0> user = User.where(id: 1).first # 指定root账户
=> #<User id:1 @root>
irb(main):002:0> user.password = 'adsasdasdasdas' # 设置密码
=> "adsasdasdasdas"
irb(main):003:0> user.password_confirmation = 'password' # 确认密码
=> "adsasdasdasdas"
irb(main):004:0> user.save! # 保存配置
Enqueued ActionMailer::MailDeliveryJob (Job ID: cc20a600-f7ba-45d1-93fd-ca8e4cb4ccba) to Sidekiq(mailers) with arguments: "Dev
=> true
irb(main):005:0> exit
写作不易,转载请注明出处,谢谢~~