How to change the admin password on GitLab

To Change admin password on Gitlab.

Introduction:

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.

Configuration Steps:

Step 1: To check the os version.

[root@linuxhelp ~]# cat /etc/os-release
NAME=Fedora
VERSION="34 (Workstation Edition)"
ID=fedora
VERSION_ID=34
PLATFORM_ID="platform:f34"
PRETTY_NAME="Fedora 34 (Workstation Edition)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:34"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f34/system-administrators-guide/"
SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=34
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=34
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
VARIANT="Workstation Edition"
VARIANT_ID=workstation

Step 2: To 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 6.1.4.1)
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 = '!@#$%^&*'
=> "!@\#$%^&*"
irb(main):004:0> u.save!
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
irb(main):005:0>exit

Step 3: Then go to the browser search your gitlab and enter login details.

with This Gitlab admin password reset process comes to an End

FAQ
Q
What is the command for gitlab password change?
A
gitlab-rails console -e production
Q
What is GitLab Admin user?
A
The Admin Area provides a web UI to manage and configure some features of GitLab self-managed instances. If you are an administrator,
you can access the Admin Area by visiting /admin on your self-managed instance. ... GitLab versions 14.0 and later: on the top bar, select Menu > Admin.
Q
How do I find my GitLab password?
A
1.Rails console
2.Start a Rails console.
3.Find the user either by username, user ID or email ID: user = User.
4.Reset the password user.
5.When using this method instead of the Users API, GitLab sends an email to the user stating that the user changed their password.
6.Save the changes:
Q
What is GitLab default password?
A
GitLab's administration interface is accessed over the web. Simply point your browser to the hostname or IP address

where GitLab is installed, and log in as an admin user. The default username is Root , and the default password is you can see this location lication "vim /etc/gitlab/initial_root_password"
Q
How do I reset my GitLab password?
A
GitLab asks for a username, a password, and a password confirmation. Upon giving proper values for them,
the password of the specified user is updated. To reset the default admin password, run this Rake task with
the username root , which is the default username of that administrator account.