If your git session forgets your credentials after 15 minutes on Linux then it could be that you’re using the cache instead of the store (for good reasons).
I’m using 2FA and have to use Personal Access Tokens to write access my repos:
GitHub push with 2FA (Personal Access Token)
From the GitHub docs Person Icon, Settings, Developer Settings, Personal access tokens.
# default timeout of 15minutes git config --global credential.helper cache # stores on disk git config --global credential.helper store
Hope this helps (and for my future self too)!
Changing Stored Credentials
As I’m storing all passwords in the store (above) I can manually delete them from disk
cd ~ sudo vim .git-credentials
Then the UI will prompt me for another password