Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clone: auto-enable git-credential-store when necessary
If the user clones with a URL containing a password and has no credential helper configured, we're stuck. We don't want to write the password into .git/config because that risks accidentally disclosing it. But if we don't record it somewhere, subsequent fetches will fail unless the user is there to input the password. The best advice we can give the user is to set up a credential helper. But we can actually go a step further and enable the "store" helper for them. This still records the password in plaintext, but: 1. It's not inside the repo directory, which makes it slightly less likely to be disclosed. 2. The permissions on the storage file are tighter than what would be on .git/config. So this is generally a security win over the old behavior of writing it into .git/config. And it's a usability win over the more recent behavior of just forgetting the password entirely. The biggest downside is that it's a bit magical from the user's perspective, because now the password is off in some other file (usually ~/.git-credentials, but sometimes in $XDG_CONFIG_HOME). Which complicates things if they want to purge the repo and password, for example, because now they can't just delete the repository directory. The file location is documented, though, and we point people to the documentation. So perhaps it will be enough (and better still, may lead to them configuring a more secure helper). Signed-off-by: Jeff King <[email protected]>
- Loading branch information