GitLab修改用户密码

    su - git
    gitlab-rails console production
    user = User.where(email: 'admin@localhost').first 或者 User.where(id:1).first
    user.password = 'yourpassword'
    user.save!

演示:

    root@115:/var/opt/gitlab# su - git
    $ gitlab-rails console production
    -------------------------------------------------------------------------------------
     GitLab:       11.4.5 (f5536c6)
     GitLab Shell: 8.3.3
     postgresql:   9.6.8
    -------------------------------------------------------------------------------------
    Loading production environment (Rails 4.2.10)
    irb(main):001:0> user = User.where(email: '[email protected]').first
    => #
    irb(main):002:0> user.password = 'password'
    => "password"
    irb(main):003:0> user.save!
    Enqueued ActionMailer::DeliveryJob (Job ID: 6866e79d-a3ec-4ffc-b699-9c77400493d0) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", gid://gitlab/User/3
    => true
    irb(main):004:0> 

你可能感兴趣的:(Git)