Gitlab用户密码忘记如何修改

采用的是docker启动的gitlab服务,当研发人员密码忘记如何修改呢?

#查看docker服务
[root@Gitlab_SVN ~]#docker ps 
CONTAINER ID        IMAGE                                         COMMAND                  CREATED             STATUS                 PORTS                                                            NAMES
d3b78b4b8d24        gitlab/gitlab-ce:10.2.3-ce.0                  "/assets/wrapper"        10 days ago         Up 10 days (healthy)   0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 0.0.0.0:4422->22/tcp   gitlab-java

#进入容器
[root@Gitlab_SVN ~]#docker exec -it gitlab-java /bin/bash
root@d3b78b4b8d24:/#

#执行命令
root@d3b78b4b8d24:/# gitlab-rails console
Loading production environment (Rails 4.2.8)

#查找该用户
irb(main):001:0> user = User.where(username: 'lawrence').first
=> #<User id:5 @lawrence>

#修改密码
irb(main):002:0> user.password = 'lawrence'
=> "lawrence"

#保存修改
irb(main):003:0> user.save!
Enqueued ActionMailer::DeliveryJob (Job ID: 3add15ae-5e56-45ee-a081-564f397c9897) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", gid://gitlab/User/5
=> true

#ctrl+d退出,ctrl+p+q退出容器
irb(main):004:0> 
root@d3b78b4b8d24:/# read escape sequence
posted @ 2019-11-27 14:44  运维人在路上  阅读(6961)  评论(0编辑  收藏  举报