Open a-t-0 opened 3 years ago
<p>After you type the <code>gitlab-rails..</code> command, you wait until you see the <code>:0></code> and then you start typing, and enter for each line. It will also give some output inbetween, like:</p>
root@127:/# gitlab-rails console -e production
--------------------------------------------------------------------------------
Ruby: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
GitLab: 13.12.3 (757327a59bc) FOSS
GitLab Shell: 13.18.0
PostgreSQL: 12.6
--------------------------------------------------------------------------------
Loading production environment (Rails 6.0.3.6)
irb(main):001:0> user = User.where(id: 1).first
=> #<User id:1 @root>
irb(main):002:0> user.password = 'yoursecret'
=> "yoursecret"
irb(main):003:0> user.password_confirmation = 'yoursecret'
=> "yoursecret"
irb(main):004:0> user.save
Enqueued ActionMailer::MailDeliveryJob (Job ID: somelongkey to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", {:args=>[#<GlobalID:someothershorterkey @uri=#<URI::GID gid://gitlab/User/1>>]}
=> true
irb(main):005:0> exit
root@127:/#
Why: Sometimes a user may forgot a GitLab password without wanting to make and restore a complete backup of the server in a fresh GitLab server installation.
search for your Docker CONTAINER_ID
docker ps -all
eg
docker exec -it d0bbe0e1e3db bash
<-- with your CONTAINER_ID$ gitlab-rails console -e production