How to change gitea admin password from the command/terminal line

Switch to gitea user inside the terminal.

su git

/usr/local/bin/gitea --config /etc/gitea/app.ini admin change-password --username [USERNAME] --password [NEW_PASSWORD]

Please do not miss the –config part as it can mess up your existing configuration. It’s best to keep app.ini locked by removing write privileges for user and other.

It might be trivial but I find many people miss the “admin” part just before the “change-password”. As everyone is probably copy/pasting stuff.

Once you have changed the password, be sure to update it to again in the web interface to a much strong password.