Skip to content

Instantly share code, notes, and snippets.

@f3rdy
Created January 28, 2017 07:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save f3rdy/f848ad5de91b3365415584ac8a0aab9e to your computer and use it in GitHub Desktop.
Save f3rdy/f848ad5de91b3365415584ac8a0aab9e to your computer and use it in GitHub Desktop.
How to reset admin password in gitlab
# logon at your gitlab server
#
# $ sudo gitlab-rails console production
Loading production environment (Rails 4.2.7.1)
irb(main):001:0> user = User.where(id: 1).first
=> #< USER ADMIN >
irb(main):002:0> user.password = 'my_new_pass'
irb(main):003:0> user.password_confirmation = 'my_new_pass'
=> "my_new_pass"
irb(main):004:0> user.save!
Enqueued ActionMailer::DeliveryJob (Job ID: a-fancy-alphanumerical-id ) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", gid://gitlab/User/1
=> true
@bby-bishopclark
Copy link

bby-bishopclark commented Aug 31, 2017

This doesn't seem to work any longer with gitlab-ce-9.5.2-ce.0.el7.x86_64 . The login page still demands we change the password again(?) by hand, if someone else hasn't beaten us to the amazon box and chowned the server.

@rahaalizade
Copy link

I disagree!
this solution works fine for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment