How to Reset the Admin Password of Gitlab
How To Reset admin password of gitlab
Resetting procedure
To start the resetting procedure, Login to your gitlab server and execute the following commands in the terminal to gain access for gitlab-rails console
root@linuxhelp:~# gitlab-rails console production
DEPRECATION WARNING: Passing the environment's name as a regular argument is deprecated and will be removed in the next Rails version. Please, use the -e option instead. (called from require at bin/rails:4)
--------------------------------------------------------------------------------
GitLab: 12.1.0 (295480f4553)
GitLab Shell: 9.3.0
PostgreSQL: 10.7
--------------------------------------------------------------------------------
Loading production environment (Rails 5.2.3)
Next use the below command to select the user id whom you want to reset password, in this case its root (admin) user. Here root (admin) user is the very first user so the id must me number 1.
irb(main):001:0> u = User.where(id:1).first
=> #<User id:1 @root>
Next enter the new password for the user using below command.
irb(main):002:0> u.password = 'linux@123'
=> "Netaxis@123"
Confirm the password by entering the following command.
irb(main):010:0> u.password_confirmation = 'linux@123'
=> "Netaxis@123"
Save the password in the console.
irb(main):021:0> u.save!
Enqueued ActionMailer::DeliveryJob (Job ID: 0828d1a8-c7c9-421f-bd32-71b1fce6fbd0) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", #<GlobalID:0x00007ff23a96edb0 @uri=#<URI::GID gid://gitlab/User/1>>
=> true
Now exit from console.
irb(main):027:0> exit
The password has been reset. Now try to login to your gitalb account using the modified password.
Comments ( 0 )
No comments available