This and that are different things. user.password
is not a git config item at all, and user.name
is just the name that'll be used by default when you use git commit
: https://git-scm.com/docs/git-config#Documentation/git-config.txt-username
When doing a git push
, the prompt you're seeing is for github credentials, a completely unrelated set of identifier which is specific to github and doesn't have to correlate to the user.name (and user.email) you've configured in git
.
Git does have a separate category for credentials. You can configure a credential helper which provides git with credentials to use (possibly filtered by domain). By default, git comes with two helpers, cache (which stores the credentials in memory for some time, 15mn by default) and store (which stores the credentials on disk unencrypted).
The former is not very useful if you're only pushing once in a while (though you can increase the timeout to something much larger e.g. a timeout of 30000 would be 8h so you'd have to input your credentials at the start of the day then wouldn't have to worry about it until the next day) and the latter is not very safe (though you could store the store file on an encrypted thumbdrive or something).
There are also credential helpers provided by third parties which can integrated with your system's credential management system if it has one e.g. GCM to integrate with the Windows Credential Store, osxkeychain
to integrate with OSX's built-in keychain (that's actually provided with git though somewhat undocumented), etc...
An other alternative is to push/pull over ssh and use ssh-agent to remember your keys and credentials.