修改gitlab账号密码

朱治龙
2023-08-27 / 0 评论 / 17 阅读 / 正在检测是否收录...

由于本人的gitlab为个人所用,隔久了未用,之前设置的密码不能登录了,便试着在数据库层面重置密码,主要过程如下:

lroot@ced14df59def:/opt/gitlab/bin# gitlab-rails console
--------------------------------------------------------------------------------
 GitLab:       13.3.5 (467cb4161ad) FOSS
 GitLab Shell: 13.6.0
 PostgreSQL:   11.7
--------------------------------------------------------------------------------
Loading production environment (Rails 6.0.3.1)
irb(main):001:0> u = User.where(email: 'i@zhuzhilong.com').first
=> #<User id:2 @zhuzl>
irb(main):002:0> u.password='20080708'
=> "20080708"
irb(main):003:0> u.save!
Enqueued ActionMailer::MailDeliveryJob (Job ID: 771d129b-3bcf-4160-a96e-7b2d63f32463) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", {:args=>[#<GlobalID:0x00007f659ce79a10 @uri=#<URI::GID gid://gitlab/User/2>>]}
=> true
irb(main):004:0>

备份

gitlab-rake gitlab:backup:create

还原

#从1530156812_2023_08_27_13.3.5编号备份中恢复
gitlab-rake gitlab:backup:restore BACKUP=1530156812_2023_08_27_13.3.5

参考页面:

0

评论 (0)

取消