SSH public key stops working after a while with 403 Forbidden

I’ve not confirmed how long it takes, it’s at least a couple days, but eventually I start to get the following message when trying to communicate to my Gitea server over ssh:

$ git push
Gitea: Internal Server Error
Gitea: Internal Server Error
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Looking at the server logs, I see the following:

Accepted publickey for git from 10.42.3.0 port 35749 ssh2: [my public key]
2021/09/27 19:36:35 Started GET /api/internal/serv/command/4/[my team]/[my repo]?mode=2&verb=git-receive-pack for 127.0.0.1:51698
2021/09/27 19:36:35 Completed GET /api/internal/serv/command/4/[my team]/[my repo]?mode=2&verb=git-receive-pack 403 Forbidden in 151.573µs
2021/09/27 19:36:35 Started POST /api/internal/ssh/log for 127.0.0.1:51700
2021/09/27 19:36:35 Completed POST /api/internal/ssh/log 403 Forbidden in 120.841µs
Received disconnect from 10.42.3.0 port 35749:11: disconnected by user
Disconnected from user git 10.42.3.0 port 35749

If I restart the server, suddenly my public key works again… until the next time it stops working.

I’m currently running this as a helm chart in Kubernetes, in case that matters.
Is there somewhere I should start to look for problems? I don’t want to have to restart the server every day, just to make sure logins work.

I haven’t been able to find any mentions of this specific problem anywhere in the forums etc. Usually if the keys are broken, they’re broken. But in my case, they work, until they don’t, and then work again after a restart.

1 Like

Which helm chart are you using/version of it? Could you post (a properly sanitized) version of your values.yml file?