Use SSH
If you’re comfortable with the command line, my recommendation would be to set up a GitHub SSH key, and switch your remote URL from HTTPS to SSH. (Or instead of switching it, you can clone it again with the SSH url instead of the HTTPS url.)
This is how to set up a GitHub SSH key:
- Checking for existing SSH keys - GitHub Docs
- Generating a new SSH key and adding it to the ssh-agent - GitHub Docs
- Adding a new SSH key to your GitHub account - GitHub Docs
(If you are the only person with access to your computer, my recommendation is to not enter a passphrase (“empty for no passphrase”) and to not add your key to the the ssh-agent. Only follow this advice if you understand the security implications.)
Use HTTPS and cache credentials
I haven’t done this, so I can’t guarantee anything, but basically, you need to cache your GitHub credentials. Coincidentally, I just answered this question on the Obsidian Git repo: https://github.com/denolehov/obsidian-git/issues/254#issuecomment-1173180978.