Admin users can't login, normal users can

I have created a gitea instance on localhost and copied the repos and database from a working server. However, on localhost, logging in does not work for the admin user, just for normal users. If I try to login as the admin user, I am getting redirected to the login page immediately, and on the top right I can see “Sign In”. If I use the wrong password, I get an error message. I tried to create another admin user from the command line, but this user has the same problem. I am using 1.10.0 on Debian Buster/amd64, together with a Pg database. What gives?

I’d suggest you create a new user with admin privileges and regenerate keys and hooks from command line using:

gitea --config /path/to/app.ini admin create-user --username newadmin --password value --email unique-email@mycompany --admin
gitea --config /path/to/app.ini admin regenerate keys
gitea --config /path/to/app.ini admin regenerate hooks 

If you can get in with this new admin, you can go and check what’s wrong with your other user. But probably some problems may have happened by just moving the program around.

Thank you for the idea, but this didn’t solve this specific problem. It turned out that it’s a hit-and-miss experience to begin with, for every user (with “miss” being the normal result). In the end, I figured that, when running on localhost, I need to change my [session] configuration like this:

From:

COOKIE_SECURE = True # production setting

to:

COOKIE_SECURE = False # when running on localhost w/o SSL

1 Like