GitLab 17.10.0 重置管理员 root 密码

文章目录


一般情况下,重置密码和版本关系不大,但没实际测试过,所以这里列出实际测试的版本:

// 查看 gitlab 版本

$ gitlab-rake gitlab:env:info

System information
System:         Ubuntu 24.04
Current User:   git
Using RVM:      no
Ruby Version:   3.2.5
Gem Version:    3.6.5
Bundler Version:2.6.5
Rake Version:   13.0.6
Redis Version:  7.0.15
Sidekiq Version:7.2.4
Go Version:     unknown

GitLab information
Version:        17.10.0
Revision:       d8c1ba94b65
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     PostgreSQL
DB Version:     16.8
URL:            https://gitlabtest.xiodi.cn
HTTP Clone URL: https://gitlabtest.xiodi.cn/some-group/some-project.git
SSH Clone URL:  git@gitlabtest.xiodi.cn:some-group/some-project.git
Using LDAP:     no
Using Omniauth: yes
Omniauth Providers:

GitLab Shell
Version:        14.41.0
Repository storages:
- default:      unix:/var/opt/gitlab/gitaly/gitaly.socket
GitLab Shell path:              /opt/gitlab/embedded/service/gitlab-shell

Gitaly
- default Address:      unix:/var/opt/gitlab/gitaly/gitaly.socket
- default Version:      17.10.0
- default Git Version:  2.48.1.gl1

// 重置 root 密码

$ gitlab-rails console            // 进入 gitlab 控制台,大概会卡个几秒
--------------------------------------------------------------------------------
 Ruby:         ruby 3.2.5 (2024-07-26 revision 31d0f1a2e7) [x86_64-linux]
 GitLab:       17.10.0 (d8c1ba94b65) FOSS
 GitLab Shell: 14.41.0
 PostgreSQL:   16.8
------------------------------------------------------------[ booted in 42.78s ]
Loading production environment (Rails 7.0.8.7)
irb(main):001:0> user = User.where(@root).first   // 获取管理员用户(管理用户名:root)
=> #<User id:1 @root>
irb(main):002:0> user.password='xiodi.cn123'     // 设置管理员为新的密码
=> "xiodi.cn123"
irb(main):003:0> user.save!                     // 保存
=> true
irb(main):004:0> exit                          // 退出
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

云途行者

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值