Question

Gitlab reset Password for root

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


Submit an answer


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!

Sign In or Sign Up to Answer

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.

alexdo
Site Moderator
Site Moderator badge
October 23, 2023

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!

Bobby Iliev
Site Moderator
Site Moderator badge
October 19, 2023

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

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more