侧边栏壁纸
博主头像
★街角晚灯★ 博主等级

博观而约取 厚积而薄发

  • 累计撰写 468 篇文章
  • 累计创建 185 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

Gitlab问题之重置root密码

WinJay
2021-09-10 / 0 评论 / 0 点赞 / 260 阅读 / 0 字 / 正在检测是否收录...

登录gitlab服务器

本环境是用docker安装

1、进入gitlab容器

docker exec -it gitlab bash

2、切换git用户

su - git

3、查看gitlab组件

ls

4、进入gitlab控制台

gitlab-rails console production

或者(不同版本有区别)

gitlab-rails console -e production

5、查询gitlab超管用户信息

user = User.where(id:1).first

image.png

image.png

如下提示代表成功:

irb(main):004:0> user.save!
Enqueued ActionMailer::DeliveryJob (Job ID: 7dc9cc44-0296-4a62-8b9a-335d4d5da11b) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", gid://gitlab/User/1
=> true

root@9a8481b3b704:/# su git
$ ls
RELEASE  assets  bin  boot  dev  etc  home  lib  lib32	lib64  libx32  linuxrc	media  mnt  opt  proc  root  run  sbin	srv  sys  tmp  usr  var
$ gitlab-rails console -e production
--------------------------------------------------------------------------------
 Ruby:         ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
 GitLab:       14.2.3 (2324101daeb) FOSS
 GitLab Shell: 13.19.1
 PostgreSQL:   12.7
--------------------------------------------------------------------------------
Loading production environment (Rails 6.1.3.2)
irb(main):001:0> user = User.where(id:1).first
=> #<User id:1 @Root>
irb(main):002:0> user.password=12345678
=> 12345678
irb(main):003:0> user.password_confirmation=12345678
=> 12345678
irb(main):004:0> user.save!
Enqueued ActionMailer::MailDeliveryJob (Job ID: ad6ce6b1-3454-490a-b4a3-22c2464da178) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", {:args=>[#<GlobalID:0x00007fb987eef848 @uri=#<URI::GID gid://gitlab/User/1>>]}
=> true
irb(main):005:0>
0
Git
  1. 支付宝打赏

    qrcode alipay
  2. 微信打赏

    qrcode weixin

评论区