'Change admin password in Gitea
I created an admin user with a password, that contains a special character. Installation of Gitea was successful, but I can't login. I can't get new password, because it says:
Sorry, Register Mail Confirmation has been disabled.
I tried command gitea admin change-password, but command is not recognized.
Solution 1:[1]
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/giteais 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.iniwhich is expected by default.
Solution 2:[2]
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"
Solution 3:[3]
When using a dockerized gitea service, you will have to execute the gitea admin ... command inside the container as git user instead of root:
docker exec -it <container ID> su git bash -c "gitea admin change-password --username <username> --password <password>"
Replace <container ID>, <username> and <password> with the appropriate values.
Solution 4:[4]
(docker swarm)
docker exec( or ssh or however you get to shell- inner command for reset
gitea -c /etc/gitea/app.ini admin admin change-password --username <username> --password <password> - inner command for list
gitea -c /etc/gitea/app.ini admin user list
Solution 5:[5]
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)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Rendy The Code |
| Solution 3 | marc |
| Solution 4 | Bash Stack |
| Solution 5 | luochen1990 |
