原创

GitLab管理员密码重置


1、默认账号

GitLab的默认管理员账号是root

2、重新设置密码

通过GitLab安装服务器里面的执行文件进行密码修改

  • 进入GitLab安装系统
  • 找到安装目录下的执行目录文件中的gitlab-rails可执行文件
  • 通过以下命令进行密码重置
## 进入安装目录下的执行目录
cd /opt/gitlab/bin

## gitlab-rails控制台
[root@localhost bin]# ./gitlab-rails console
--------------------------------------------------------------------------------
 GitLab:       12.4.0 (1425a56c75b)
 GitLab Shell: 10.2.0
 PostgreSQL:   10.9
--------------------------------------------------------------------------------

Loading production environment (Rails 5.2.3)
irb(main):001:0>
irb(main):002:0> user = User.where(username:'root').first
=> #<User id:1 @root>
irb(main):003:0> user.password='root'
=> "root"
irb(main):004:0> user.password_confirmation='root'
=> "root"
irb(main):005:0> user.save!
Traceback (most recent call last):
        1: from (irb):5
ActiveRecord::RecordInvalid (Validation failed: Password is too short (minimum is 8 characters))
irb(main):006:0> user.password='Root@123456'
=> "Root@123456"
irb(main):007:0> user.password_confirmation='Root@123456'
=> "Root@123456"
irb(main):008:0> user.save!
Enqueued ActionMailer::DeliveryJob (Job ID: b92b1594-9067-4639-a45c-70da43a69aed) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", #<GlobalID:0x00007fc776abfa78 @uri=#<URI::GID gid://gitlab/User/1>>
=> true
irb(main):009:0> quit
[root@localhost bin]#

GIT
  • 作者:一介闲人(联系作者)
  • 发表时间: 2024-07-15 10:59
  • 版权声明:原创-转载需保持署名
  • 公众号转载:请在文末添加本文链接
  • 评论