How to reset user password via console in gitlab

From DevOps Notebook

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!