Change admin password in Gitea
For Current GITEA sometime it will not work by
cd /path/to/gitea
./gitea admin change-password --username myusername --password asecurenewpassword
You need to specify the configuration also e.g. :
cd /path/to/gitea
./gitea admin change-password --username myusername --password asecurenewpassword -c "/etc/gitea/app.ini"
From your issue, any gitea command (like gitea admin change-password --username myusername --password asecurenewpassword
) ends up with:
gitea: command not found
If you installed from binary, you will note that the $PATH was not modified, and gitea
was called directly from its installation folder.
./gitea web
So you can do the same for changing the password:
cd /path/to/gitea
./gitea admin change-password --username myusername --password asecurenewpassword
Note that Robert Ranjan adds in the comments:
/path/to/gitea
is gitea's home path, where you find foldercustom
.
In my case gitea's home is/var/lib/gitea
. From this path, you should see file:custom/conf/app.ini
which is expected by default.
For NixOS users, it's a bit more complicated:
su
su gitea
nix-shell -p gitea
gitea admin user change-password -c /var/lib/gitea/custom/conf/app.ini -u user-name -p new-pwd
(tested on Gitea version 1.15.6)
It's the future now and the other answers will no longer work. I found this answer because I had the same problem. I know I will mess this up again as this is already my second time, so hello future me!
Non-docker answer:
gitea admin user change-password -u <username> -p <password>
Docker answer:
docker exec -it <container ID> su git bash -c "gitea admin user change-password -u <username> -p <password>"
Replace <container ID>
, <username>
and <password>
with the appropriate values.
Relevant Gitea Documentation