To avoid having to constantly type your username for https://git.overleaf.com (or any other Git HTTPS connection), set in your main ~/.gitconfig file:
[credential "https://git.overleaf.com"] username = firstname.lastname@example.org
Use the same email address you use to login to Overleaf. You will still need to type your password
Optionally, you can set a Git credential cache. The command below remembers your password for 300 seconds (5 minutes).
git config --global credential.helper 'cache --timeout=300'
The Git credential cache is for HTTPS Git credentials, SSH credential caching is not affected.