一般情况下,重置密码和版本关系不大,但没实际测试过,所以这里列出实际测试的版本:
// 查看 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 // 退出
作者:jackzang 创建时间:2025-03-27 17:19
最后编辑:jackzang 更新时间:2025-03-27 17:27
最后编辑:jackzang 更新时间:2025-03-27 17:27