Create Admin CLI for listing users #2876

Closed
opened 2025-11-02 04:52:15 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @randyesq on GitHub (Feb 7, 2019).

  • Gitea version (or commit ref): 1.7.1
  • Git version: 2.18.1
  • Operating system: gitea docker image (alpine)
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

I would like to be able to create the first (admin) user without the Web UI. After starting up gitea with gitea web, I would like to be able to use the admin CLI to create a user. However, since I am running in a container that may be restarted at any time, it would be best to have a way to check if a user is already created before attempting to create it.

Right now, you can just do gitea admin create-user ... and if the return code is 0, it was created. If it is 1, then the user may exist, or something else may have gone wrong. It would be better to be able to have a command that lists users instead of having to try and create it to see if it already exists.
...

Screenshots

Originally created by @randyesq on GitHub (Feb 7, 2019). <!-- 1. Please speak English, this is the language all of us can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/NsatcWJ) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.7.1 - Git version: 2.18.1 - Operating system: gitea docker image (alpine) - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: ## Description I would like to be able to create the first (admin) user without the Web UI. After starting up gitea with `gitea web`, I would like to be able to use the admin CLI to create a user. However, since I am running in a container that may be restarted at any time, it would be best to have a way to check if a user is already created before attempting to create it. Right now, you can just do `gitea admin create-user ...` and if the return code is 0, it was created. If it is 1, then the user _may_ exist, or something else may have gone wrong. It would be better to be able to have a command that lists users instead of having to try and create it to see if it already exists. ... ## Screenshots <!-- **If this issue involves the Web Interface, please include a screenshot** -->
GiteaMirror added the issue/confirmedtype/enhancement labels 2025-11-02 04:52:15 -06:00
Author
Owner

@adelowo commented on GitHub (Feb 7, 2019):

So I am thinking something like admin list with flags like --name "oops" ( to use as a query to search for related users). But how would this deal with pagination if say 200 users exist, looks like a whole lot of data to fit in at once.

@adelowo commented on GitHub (Feb 7, 2019): So I am thinking something like `admin list` with flags like `--name "oops"` ( to use as a query to search for related users). But how would this deal with pagination if say 200 users exist, looks like a whole lot of data to fit in at once.
Author
Owner

@stale[bot] commented on GitHub (Apr 9, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Apr 9, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@jolheiser commented on GitHub (Feb 11, 2021):

Resolved by https://github.com/go-gitea/gitea/pull/10492

@jolheiser commented on GitHub (Feb 11, 2021): Resolved by https://github.com/go-gitea/gitea/pull/10492
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2876