欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

gitlab修改用户密码

程序员文章站 2024-01-30 23:18:16
...

gitlab修改用户密码


  1. 进入gitlab的管理  sudo gitlab-rails console production  ;
  2. 查询丢失人的用户信息       user  =  User.where(id: 1).first  or  
      user  =    User.where(name:''xiaoqiang").first;  通过这个可以查询用户
      name、email和id等信息
  3. 重置密码为123456 user.password='12345678'
  4. 确认密码为123456 user.password_confirmation='12345678 '
  5. 保存 user.save!
  6. 退出 quit

gitlab修改用户密码官方文档


  1. gitlab-rails console production
  2. user = User.where(id: 1).first
  3. user = User.find_by(email: '[email protected]')
  4. user.password = 'secret_pass'
      user.password_confirmation = 'secret_pass'
  5. user.save!

[email protected]:~# gitlab-rails console production
-------------------------------------------------------------------------------------
 GitLab:       11.10.4-ee (88a3c791734)
 GitLab Shell: 9.0.0
 PostgreSQL:   9.6.11
-------------------------------------------------------------------------------------
Loading production environment (Rails 5.0.7.2)
irb(main):001:0>  user=User.where(name:"shiyang").first
=> #<User id:16 @shiyang>
irb(main):003:0> user
=> #<User id:16 @shiyang>
irb(main):004:0> user.password='123456789'
=> "123456789"
irb(main):005:0> user.password_confirmation='123456789'
=> "123456789"
irb(main):006:0> user.save!
Enqueued ActionMailer::DeliveryJob (Job ID: 514a8cee-39de-4ef1-9b81-2ffac53a8a2d) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", #<GlobalID:0x00007f1939491cc8 @uri=#<URI::GID gid://gitlab/User/16>>
=> true
irb(main):007:0> quit
[email protected]:~#