GitLab 操作整理

  1. 進入 gitlab console

    gitlab-rails console

  2. 找到 root

    user = User.find_by(username: 'root')

  3. 設定新密碼

    user.password = '**new password**'

  4. 確認新密碼

    user.password_confirmation = '**new password**'

  5. 將設定存檔

    user.save

  • 整體過程如下:

    [email protected] ~# gitlab-rails console           
     Ruby:         ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
     GitLab:       13.6.3 (857c6c6a6a9) FOSS
     GitLab Shell: 13.13.0
     PostgreSQL:   11.9
    --------------------------------------------------------------------------------
    Loading production environment (Rails 6.0.3.3)
    irb(main):001:0> 
    irb(main):002:0> user = User.find_by(username: 'root')
    => #<User id:1 @root>
    irb(main):003:0> user.password = '**new password**'
    => "**new password**"
    irb(main):004:0> user.password_confirmation = '**new password**'
    => "**new password**"
    irb(main):005:0> user.save
    Enqueued ActionMailer::MailDeliveryJob (Job ID: dc1d94bf-bafb-45xx-b2ae-084xx8b820a4) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", {:args=>[#<GlobalID:0x00007f4354xxc600 @uri=#<URI::GID gid://gitlab/User/1>>]}
    => true
    irb(main):006:0> exit
    [email protected] ~# 

  • tech/gitlab.txt
  • 上一次變更: 2021/02/06 22:17
  • jonathan