Authentication failed for, but running the command again works?

Sometimes my authentication with git on Windows is lost? I guess it happens after x amount of time has passed.
When it happens the command (fetch, pull, push etc) will fail with a error, but if I run the command immediately again it works.

image

How can I resolve this? I use HTTPS (not SSH) for communicating with Gitea.
Is it a setting somewhere within Gitea or is this a Git issue?

I found this setting here Config Cheat Sheet | Gitea Documentation
Increasing ACCESS_TOKEN_EXPIRATION_TIME to 24 hours from 1 hour does improve it.
It happens way less often now and it works for me.