Red hat linux

Gitlab reset Password for root

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!

Leave a Reply

Your email address will not be published. Required fields are marked *