gitlab修改root密码

  • Post author:
  • Post category:其他


1. 在root用户下,执行

gitlab-rails console production 或  sudo gitlab-rails console production

2、获得用户数据,修改用户密码

[root@svr34 bin]# gitlab-rails console production
Loading production environment (Rails 4.2.5.2)

irb(main):001:0> user = User.where(id: 1).first
=> #<User id:1 @root>

irb(main):002:0> user.password="12345678"
=> "12345678"

irb(main):003:0> user.password_confirmation="12345678"
=> "12345678"

irb(main):004:0> user.save!
=> true

irb(main):005:0> quit