credential: add credential.*.username
Credential helpers can help users avoid having to type their username and password over and over. However, some users may not want a helper for their password, or they may be running a helper which caches for a short time. In this case, it is convenient to provide the non-secret username portion of their credential via config. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
118250728e
commit
d5742425eb
@ -113,6 +113,22 @@ test_expect_success 'http auth respects credential helper config' '
|
||||
expect_askpass none
|
||||
'
|
||||
|
||||
test_expect_success 'http auth can get username from config' '
|
||||
test_config_global "credential.$HTTPD_URL.username" user@host &&
|
||||
>askpass-query &&
|
||||
echo user@host >askpass-response &&
|
||||
git clone "$HTTPD_URL/auth/repo.git" clone-auth-user &&
|
||||
expect_askpass pass user@host
|
||||
'
|
||||
|
||||
test_expect_success 'configured username does not override URL' '
|
||||
test_config_global "credential.$HTTPD_URL.username" wrong &&
|
||||
>askpass-query &&
|
||||
echo user@host >askpass-response &&
|
||||
git clone "$HTTPD_URL_USER/auth/repo.git" clone-auth-user2 &&
|
||||
expect_askpass pass user@host
|
||||
'
|
||||
|
||||
test_expect_success 'fetch changes via http' '
|
||||
echo content >>file &&
|
||||
git commit -a -m two &&
|
||||
|
Reference in New Issue
Block a user