[root@zabbix-server ~]# su - git
-sh-4.2$
-sh-4.2$
-sh-4.2$
2 输入以下命令
-sh-4.2$ gitlab-rails console production
DEPRECATION WARNING: Passing the environment's name as a regular argument is
deprecated and will be removed in the next Rails version. Please, use the -e option
instead. (called from require at bin/rails:4)
--------------------------------------------------------------------------------
GitLab: 12.3.6 (82ff748612c)
GitLab Shell: 10.0.0
PostgreSQL: 10.9
--------------------------------------------------------------------------------
Loading production environment (Rails 5.2.3)
irb(main):001:0>
3 查询id等于1的用户, 一般就是root用户。
irb(main):001:0> user = User.where(id: 1).first
=> #<User id:1 @root>
irb(main):002:0>