0

I am using gitea latest image. It used Postgres DB (using the latest postgress image).

As part of automation, I need to create an admin account using Gitea rest API. I have tried the below API. But It is not working.

https:///user/sign_up

Please help me at the earliest as its a showstopper issue for my development.

I am still facing this issue, please help to fix this issue

SriSiva
  • 11
  • 1
  • 3
  • Update your question with the HTTP call you do, the endpoint, the response you have. You can follow the [how to ask guide](https://stackoverflow.com/help/how-to-ask) to structure your question. – Gearnode Jul 01 '20 at 11:08
  • Via the REST API you can't create an admin user for the access to the API you need an existing user which is a kind of chicken/egg problem. Use command line to create a user (admin) via `/app/gitea/gitea admin create-user --username admin --password XXX --email yab -c /data/gitea/conf/app.ini` and afterwards more or less everything can be done via REST API... – khmarbaise Nov 24 '20 at 14:30

1 Answers1

0

As @khmarbaise suggests commented before, and in according to the official Gitea docs, you can execute a command as below:

/app/gitea/gitea admin user create --username <USERNAME> --admin --password <PASSWORD> --email <EMAIL> -c /data/gitea/conf/app.ini

If you received an not a git user error, you can run:

su - git

Note: If your Gitea instance is deployed on docker like mine, you can run above commands in docker by:

docker exec -it <container-name_or_id> bash

Just it!

Mohsen Abasi
  • 2,050
  • 28
  • 30