1、web界面方式
2、控制台方式
gitlab版本:gitlab/gitlab-ce:14.9.3-ce.0
👉🏼 忘记密码情况下
[root@devops ~]#docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
11a54a1f4a2a gitlab/gitlab-ce:14.9.3-ce.0 "/assets/wrapper" 6 days ago Up 44 hours (healthy) 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, 0.0.0.0:2222->22/tcp devops_tutorial_gitlab
f3f039aa667a jenkins/jenkins:2.332.2-centos7-jdk8 "/sbin/tini -- /usr/…" 4 weeks ago Up 41 hours 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp, 0.0.0.0:50000->50000/tcp, :::50000->50000/tcp jenkins
[root@devops ~]#docker exec -it devops_tutorial_gitlab bash
root@11a54a1f4a2a:/# gitlab-rails console -e production
--------------------------------------------------------------------------------
Ruby: ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
GitLab: 14.9.3 (ec11aba56f1) FOSS
GitLab Shell: 13.24.0
PostgreSQL: 12.7
------------------------------------------------------------[ booted in 73.71s ]
Loading production environment (Rails 6.1.4.6)
irb(main):001:0>
irb(main):002:0> User.all
=> #<ActiveRecord::Relation [#<User id:1 @root>]>
irb(main):003:0> user = User.where(id:1).first
=> #<User id:1 @root>
irb(main):004:0> user.password='12345678'
=> "12345678"
irb(main):005:0> user.password_confirmation='12345678'
=> "12345678"
irb(main):006:0> user.save!
=> true
irb(main):007:0> exit
root@11a54a1f4a2a:/#
# 修改完后,立马生效!
it
root@11a54a1f4a2a:/#
修改完后,立马生效!
以上亲测有效!