Report this

What is the reason for this report?

Gitlab reset Password for root

Posted on October 19, 2023

Gitlab reset Password for root is not coming directly it is giving login option can you help to how to reset password of administration



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

Is it a GitLab Enterprise Edition that you are running on your Droplet? If so what you could do is to use the Rails console to reset your GitLab user password as described in the docs here:

https://docs.gitlab.com/ee/administration/operations/rails_console.html

Basically, you will need to do the following:

  1. SSH into your Droplet where GitLab is installed.

    ssh [your-user]@[your-droplet-ip-address]
    
  2. Open the GitLab Rails console. If you installed GitLab via the Omnibus package, you can open the Rails console with:

    sudo gitlab-rails console
    
  3. Locate the root user and change the password. Once in the console, enter the following commands:

    user = User.where(id: 1).first
    user.password = 'new-password-here'
    user.password_confirmation = 'new-password-here'
    user.save!
    
  4. Exit the Rails console by simply typing:

    exit
    
  5. Now, go to your GitLab login page and use root as the username and the new password you just set to log in.

  6. If you have two-factor authentication (2FA) enabled, and you also lost access to it, you can disable it from the Rails console:

    user = User.where(id: 1).first
    user.two_factor_enabled = false
    user.save!
    

Let me know how it goes!

Best,

Bobby

Heya,

I’ll also point you in direction to use the rails console to reset your password. You can follow the steps Bobby listed and also check this article in Gitlab’s docs:

https://docs.gitlab.com/ee/security/reset_user_password.html

Hope that this helps!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.