gitlab 初始密码

方法一:

gitlab-ce 初装以后,把密码放在了一个临时文件中了

# cat /etc/gitlab/initial_root_password
Password: ARVVjpDcF5g/ZG2DScarmU9s9TKUT09HQd3qUj4jq/c=
  • 1
  • 2

这个文件将在首次执行reconfigure后24小时自动删除
方法2:

<root@gitlab ~># cd /opt/gitlab/bin
<root@gitlab bin># gitlab-rails console
--------------------------------------------------------------------------------
 Ruby:         ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux]
 GitLab:       14.4.1 (1a23d731c9f) FOSS
 GitLab Shell: 13.21.1
 PostgreSQL:   12.7
--------------------------------------------------------------------------------
Loading production environment (Rails 6.1.4.1)
irb(main):001:0> u=User.where(id:1).first
=> #<User id:1 @root>
irb(main):002:0> User.all
=> #<ActiveRecord::Relation [#<User id:1 @root>]>
irb(main):003:0> u.password='12345678'
=> "12345678"
irb(main):004:0> u.password_confirmation='12345678'
=> "12345678"
irb(main):005:0> u.save!
Enqueued ActionMailer::MailDeliveryJob (Job ID: 2e04113b-4441-4b96-b85d-b6d8f4adc582) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", {:args=>[#<GlobalID:0x00007f31cb855aa8 @uri=#<URI::GID gid://gitlab/User/1>>]}
=> true
irb(main):006:0> exit
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21

再去登录就可以成功

posted @ 2023-02-18 11:23  Bashuslovakia  阅读(552)  评论(0编辑  收藏  举报