gitlab查看用户id

本文介绍了两种查看GitLab用户ID的方法:一是通过GitLab API接口查询,例如使用URL `http://10.18.13.100:10080/api/v4/users?username=test101`;二是直接进入GitLab Docker容器并操作数据库来获取用户ID。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

需求

需要查看gitlab用户的id

方法一

通过页面api查询
http://10.18.13.100:10080/api/v4/users?username=test101
在这里插入图片描述

方法二

进入gitlab数据库查询,gitlab是使用docker部署的,所以需要进入容器操作

root@10-18-13-100:~# docker ps | grep gitlab
9178130d2c2a        10.253.127.117:8080/gitlab/gitlab-ce:10.5.2-ce.0      "/.r/r /assets/wra..."   2 months ago        Up 2 months (healthy)                                                                          r-gitlab-gitlab-server-1-ca83b62b
root@10-18-13-100:~# 
root@10-18-13-100:~# 
root@10-18-13-100:~# docker exec -it  9178 bash
root@gitlab-gitlab-server-1:/# 

操作数据库

root@gitlab-gitlab-server-1:/# gitlab-rails dbconsole
psql (9.6.5)
Type "help" for help.
## 列出数据库
gitlabhq_production=> \l 
                                         List of databases
        Name         |    Owner    | Encoding | Collate |  Ctype  |        Access privileges        
---------------------+-------------+----------+---------+---------+---------------------------------
 gitlabhq_production | gitlab      | UTF8     | C.UTF-8 | C.UTF-8 | 
 postgres            | gitlab-psql | UTF8     | C.UTF-8 | C.UTF-8 | 
 template0           | gitlab-psql | UTF8     | C.UTF-8 | C.UTF-8 | =c/"gitlab-psql"               +
                     |             |          |         |         | "gitlab-psql"=CTc/"gitlab-psql"
 template1           | gitlab-psql | UTF8     | C.UTF-8 | C.UTF-8 | =c/"gitlab-psql"               +
                     |             |          |         |         | "gitlab-psql"=CTc/"gitlab-psql"
(4 rows)

gitlabhq_production=> 
## 连接数据库
gitlabhq_production=> \c gitlabhq_production 
You are now connected to database "gitlabhq_production" as user "gitlab".
gitlabhq_production=> 
## 查找账户id
gitlabhq_production=> select id from users where name = 'test101';
 id 
----
 19
(1 row)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值