Ideally SSH keys are preferred for authentication, however if a repository is only username and password based, you can use the following command to save your basic authentication credentials:
git config --global credential.helper store
Caution: These credentials will be saved in plaintext in your home directory, so proceed with caution.