• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to Reset the Admin Password of Gitlab

  • 00:37 gitlab-rails console production
  • 01:11 User.where(id:1).first
  • 01:35 u.password = 'Netaxis@123'
  • 01:51 u.password_confirmation = 'Netaxis@123'
  • 02:13 u.save!
  • 02:28 exit
{{postValue.id}}

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.

snap1 snap2 snap3

Tags:
mason
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

Which command to access the gitlab-rails in terminal?

A

execute the following commands in the terminal to gain access for gitlab-rails console.
# gitlab-rails console production

Q

Why we need to reset the gitlab admin password?

A

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&rsquo t need to reinstall gitlab just follow the simple steps to reset your gitlab admin password.

Q

Which command to save the gitlab password?

A

use the following command to save the gitlab password
> u.save!

Q

How to exit the gitlab login console in the terminal?

A

You can exit the gitlab login console by the following the command
> exit

Q

What is gitlab?

A

GitLab is a web-based repository manager for teams collaboration. It is used to create, edit new projects and merge finished code into the existing projects.

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Owen ?
How to add SSH key to my Gitlab account

I need to add the SSH key in my gitlab account. How to do so ????

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.