From d8062695941b0dc0fbd48007eb9c66963fe0b811 Mon Sep 17 00:00:00 2001 From: Steve Streeting Date: Wed, 2 Sep 2015 13:03:51 +0100 Subject: [PATCH] Include the username in the creds call if present This is needed to disambiguate cases where a user has multiple usernames on the same host. Without this the first item will be silently used which might be wrong & cause a loop of incorrect password prompts (& possibly a lockout on the server) --- lfs/credentials.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lfs/credentials.go b/lfs/credentials.go index 382906d7..413f8b8b 100644 --- a/lfs/credentials.go +++ b/lfs/credentials.go @@ -105,6 +105,9 @@ func getCredURLForAPI(req *http.Request) (*url.URL, error) { func fillCredentials(u *url.URL) (Creds, error) { path := strings.TrimPrefix(u.Path, "/") creds := Creds{"protocol": u.Scheme, "host": u.Host, "path": path} + if u.User != nil && u.User.Username() != "" { + creds["username"] = u.User.Username() + } return execCreds(creds, "fill") }