How to reset user password via console in gitlab

From DevOps Notebook
Revision as of 18:33, 28 November 2019 by MilosZ (talk | contribs) (Created page with "To reset your user password, first log into your server with root privileges. Start a Ruby on Rails console with this command: <pre> gitlab-rails console -e production </pre>...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

To reset your user password, first log into your server with root privileges. Start a Ruby on Rails console with this command:

gitlab-rails console -e production

Wait few seconds for console to load and then run:

user = User.find_by(email: '[email protected]')

Now we can change password:

user.password = 'secret_pass'
user.password_confirmation = 'secret_pass'

Save the changes.

user.save!