How to reset the admin password on GitLab

Gitlab admin password can be changed easily by using GitLab-rails command. We may have chance of forgetting GitLab admin password, so if we do we actually don’t need to reinstall GitLab just follow the simple steps to reset your GitLab admin password. This tutorial covers the ground on resetting the admin password on Gitlab.

execute this gitlab password rest command.

[root@linuxhelp ~]# gitlab-rails console -e production
 Ruby:         ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux]
 GitLab:       14.4.2 (1ce86e92f81) FOSS
 GitLab Shell: 13.21.1
 PostgreSQL:   12.7
Loading production environment (Rails
irb(main):001:0> u = User.where(id:1).first
=> #<User id:1 @root>
irb(main):002:0> u.password = '!@#$%^&*'
=> "!@\#$%^&*"
irb(main):003:0> u.password_confirmation = '!@#$%^&*'
=> "!@\#$%^&*"
Enqueued ActionMailer::MailDeliveryJob (Job ID: 58f04156-cf5e-4d90-aadb-6bae885105d3) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", {:args=>[#<GlobalID:0x00007fe19c8682d0 @uri=#<URI::GID gid://gitlab/User/1>>]}
=> true


Leave a Reply

Your email address will not be published. Required fields are marked *