登录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
如下提示代表成功:
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>
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/160375.html