Skip to content

Instantly share code, notes, and snippets.

@sykezz
Forked from f3rdy/foo.rb
Created May 27, 2019 15:38
Show Gist options
  • Save sykezz/2333f3528196307e30e1b481634cc70f to your computer and use it in GitHub Desktop.
Save sykezz/2333f3528196307e30e1b481634cc70f 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment