Appearance
GitLab 重置密码
GitLab in docker
进入到容器当中
$ docker exec -it gitlab /bin/bash
$ docker exec -it gitlab /bin/bash
Ruby on Rails console
$ gitlab-rails console production
$ gitlab-rails console production
查找
root
用户irb(main):006:0> user = User.where(id: 1).first
irb(main):006:0> user = User.where(id: 1).first
或者按照邮箱查找用户
irb(main):006:0> user = User.find_by(email: 'admin@example.com')
irb(main):006:0> user = User.find_by(email: 'admin@example.com')
重置密码(要求不少于8位)
irb(main):006:0> user.password = 'secret_pass' irb(main):006:0> user.password_confirmation = 'secret_pass'
irb(main):006:0> user.password = 'secret_pass' irb(main):006:0> user.password_confirmation = 'secret_pass'
保存更改
irb(main):006:0> user.save!
irb(main):006:0> user.save!