How to reset Gitlab admin password On CentOS 8.1
To Reset GitLab Admin Password On CentOS 8.1
INTRODUCTION:
Gitlab admin password is simply changed by using the gitlab-rails command. The Rails console. gives a way to link with the GitLab instance from the command line. It is for administrators of the GitLab system to troubleshooting problems or needs to retrieve data.
Procedure:
Start A Ruby On Rails console using the following command
[root@linuxhelp ~]# gitlab-rails console -e production
--------------------------------------------------------------------------------
GitLab: 13.5.4 (7f5f940041c) FOSS
GitLab Shell: 13.11.0
PostgreSQL: 11.9
--------------------------------------------------------------------------------
Loading production environment (Rails 6.0.3.3)
irb(main):058:0> user = User.where(id:1).first
=> #<User id:1 @root>
Create password and after it make it confirm again using following command
irb(main):059:0> user.password = 'Abhishek@net123'
=> "Abhishek@net123"
irb(main):060:0> user.password_confirmation ='Abhishek@net123'
=> "Abhishek@net123"
Now save it using the following command
irb(main):063:0> user.save!
Enqueued ActionMailer::MailDeliveryJob (Job ID: 50536092-d78e-4645-808f-2fbd492b3256) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", {:args=>[#<GlobalID:0x00007f3e7a757c58 @uri=#<URI::GID gid://gitlab/User/1>>]}
=> true
Q
What is the command to enter in GitLab rails?
A
The command to enter in GitLab rails is gitlab-rails console -e production
Q
How can we change the password?
A
We can change the password using the user name or email id.
Q
What is the command to change the password?
A
The command to change the password is the user.password ='Newpassword'
Q
What are GitLab rails?
A
The Rails console. provides a way to interact with your GitLab instance from the command line. The Rails console is for GitLab system administrators who are troubleshooting a problem
u.save!