How to change the user password on gitlab?
Here is the demonstration to reset the gitlab password:
We connect to the gitlab-rails console to reset the password of the user,
In this demonstration we are going to reset the root password of the user called root whose uid is 1
[vamshi@gitlab ~]$ sudo gitlab-rails console -e production ------------------------------------------------------------------------------------- GitLab: 11.10.4-ee (88a3c791734) GitLab Shell: 9.0.0 PostgreSQL: 9.6.11 ------------------------------------------------------------------------------------- Loading production environment (Rails 5.0.7.2) Loading production environment (Rails 5.0.7.2) irb(main):001:0> User.where(id:1).first => #<User id:1 @root>
Now we can confirm the Uid 1 Belongs to the root user and this is the account whose password we want to reset
irb(main):001:0> user=User.where(id: 1).first => #<User id:1 @root>
Now enter your new password and followup with the password confirmation:
irb(main):003:0> user.password = 'AlphanumericPassword' => "AlphanumericPassword" irb(main):004:0> user.password_confirmation = 'AlphanumericPassword' => "AlphanumericPassword"
Now save the password
irb(main):005:0> user.save Enqueued ActionMailer::DeliveryJob (Job ID: 961d30a2b-df21-45c8-83e6-1993c85e6030) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", #<GlobalID:0x10007feafe3d64e0 @uri=#<URI::GID gid://gitlab/User/1>> => true
Then we exit out of the interactive ruby shell only after saving the changes