需求
gitlab忘记了密码咋办???
只要你的gitlab能运行起来,能登陆gitlab,访问gitlab console 控制台一切都好说。
环境
omnibus gitlab 14.6.2-ce
容器化环境 k8s上
部署
docker 上登陆容器shell,执行如下命令:
root@gitlab-f999b559c-tcwgp:/# gitlab-rails console -e production
--------------------------------------------------------------------------------
Ruby: ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]
GitLab: 14.6.2 (0a901d60f8a) FOSS
GitLab Shell: 13.22.1
PostgreSQL: 12.7
--------------------------------------------------------------------------------
Loading production environment (Rails 6.1.4.1)
irb(main):001:0> User.all
=> #<ActiveRecord::Relation [#<User id:1 @root>]>
irb(main):002:0> user=User.where(id:1).first
=> #<User id:1 @root>
irb(main):003:0> user.password='hy123456'
=> "hy123456"
irb(main):004:0> user.password_confirmation='hy123456'
=> "hy123456"
irb(main):005:0> user.save!
=> true
irb(main):006:0>
备注:
默认密码位置,第一次部署gitlab自动生成的密码位置:
cat /etc/gitlab/initial_root_password