I am aware that I can use git config credential.helper to store both my username and password. But I want to ONLY store my username and have the terminal ask for my password each time I push. How is this done?
Something similar to this, but without the password.
$ git config credential.helper store
$ git push http://example.com/repo.git
Username: <type your username>
Password: <type your password>
Git credential helpers store both usernames and passwords. The design is such that if a username and password combination succeed, then the helper is told to write both items to its store.
If you want to store only the username, and not the password, then you shouldn't use a credential helper. Instead, you should disable the credential helper and write the username in the URL for the remote. For example, you can use git remote set-url origin http://[email protected]/repo.git
to set the remote URL for origin to contain your username. Note that if your username contains characters outside of letters and numbers, it may need to be percent-escaped.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With