gitlab重置root密码

gitlab版本:13.3.5   

因为忘记root密码了登录不上去,不过我们可以在服务器连接gitlab的console控制台,操作数据库,进行root密码重置,具体如下

[root@web1 backups]# gitlab-rails console -e production     
--------------------------------------------------------------------------------
GitLab: 13.3.5 (467cb4161ad) FOSS
GitLab Shell: 13.6.0
PostgreSQL: 11.7
--------------------------------------------------------------------------------

Loading production environment (Rails 6.0.3.1)
irb(main):001:0>
irb(main):002:0> user = User.where(id: 1).first      #此 user 则表示 root 用户
=> #<User id:1 @root>
irb(main):003:0> user.password = '9ig^zYEZ#kHH'               #修改密码
=> "9ig^zYEZ#kHH"
irb(main):004:0> user.password_confirmation = '9ig^zYEZ#kHH'            #确认修改的密码
=> "9ig^zYEZ#kHH"
irb(main):005:0> user.save!        #保存
Enqueued ActionMailer::MailDeliveryJob (Job ID: eb68f7b6-4d28-4a19-8742-4ab51241ebba) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", {:args=>[#<GlobalID:0x00007fec95983648 @uri=#<URI::GID gid://gitlab/User/1>>]}
=> true
irb(main):006:0>exit    #退出

 

posted @ 2021-09-15 10:13  前行520  阅读(462)  评论(0编辑  收藏  举报