How to reset the admin password via the rails console

If you forget the admin password, you can change it using the rails console.

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

1 Like

Hi, I install gitlab with the one-click package bitnami-gitlab-7.1.1-0-linux-x64-installer.run. I cannot find the bundle exec rails console command. How can I reset the password?? Thanks.

I find that I made a mistake and now I can reset the password. but find that the user is locked. What is “the user is locker”?? I cannot resolve this by restarting the server. How to ? Thanks

I tried this and get ‘nil’ back for both user.find commands

In any case someone faces this issue too, as I did, here’s the solution:

Follow @axil instructions to open up the Rails production console and find your user.

Once you’ve changed the user’s password (no need to redo it if you’ve done it previously):

user.unlock_access!

That’s it!