# SSH public key stops working after a while with 403 Forbidden

**URL:** <https://forum.gitea.com/t/ssh-public-key-stops-working-after-a-while-with-403-forbidden/3837>\
**Category:** Install/Maintain/Configure\
**Created:** [September 27, 2021, 7:47pm UTC](https://forum.gitea.com/t/ssh-public-key-stops-working-after-a-while-with-403-forbidden/3837 "2021-09-27T19:47:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![randoogle](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/randoogle/32/5009_2.png) [@randoogle](https://forum.gitea.com/u/randoogle)\
**Post date:** [September 27, 2021, 7:47pm UTC](https://forum.gitea.com/t/ssh-public-key-stops-working-after-a-while-with-403-forbidden/3837/1 "2021-09-27T19:47:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![techknowlogick](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/techknowlogick/32/4706_2.png) [@techknowlogick](https://forum.gitea.com/u/techknowlogick)\
**Post date:** [October 2, 2021, 1:59am UTC](https://forum.gitea.com/t/ssh-public-key-stops-working-after-a-while-with-403-forbidden/3837/2 "2021-10-02T01:59:09Z")

</div>

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