前几天搭建的测试gitlab,想使用一下,发现密码给忘了。此文档做为重置密码的记录
进入容器重置密码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
$ docker exec -it gitlab /bin/bash
$ root@git:/# gitlab-rails console -e production # 启动Ruby on Rails控制台
--------------------------------------------------------------------------------
GitLab: 12.10.0 (869bc26464b) FOSS
GitLab Shell: 12.2.0
PostgreSQL: 11.7
--------------------------------------------------------------------------------
Loading production environment (Rails 6.0.2)
irb(main):001:0> user = User.where(id: 1).first #查找用户
=> #<User id:1 @root>
irb(main):002:0> user.password = 'admin000' #设置密码
=> "admin000"
irb(main):003:0> user.password_confirmation = 'admin000' #再次输入密码
=> "admin000"
irb(main):004:0> user.save! #保存
Enqueued ActionMailer::DeliveryJob (Job ID: 5827de7f-357b-4c22-b13c-9fd78e02a45e) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", #<GlobalID:0x00007f17d643fd38 @uri=#<URI::GID gid://gitlab/User/1>>
=> true
irb(main):005:0> exit
|
参考链接
官方文档
Author
dylan
LastMod
2020-03-12
License
如需转载请注明文章作者和出处。谢谢!