GitLab修改用户密码
程序员文章站
2022-05-31 19:59:22
...
su - git
gitlab-rails console production
user = User.where(email: '[email protected]').first 或者 User.where(id:1).first
user.password = 'yourpassword'
user.save!
演示:
[email protected]:/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
=> #<User id:3 @fogfore>
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>
上一篇: Gitlab CI/CD
下一篇: MySQL权限