Skip to content

Add support for per-url credential helpers #2686

@technoweenie

Description

@technoweenie

LFS doesn't detect credential helpers set on a url:

[credential "https://my-git-server.com/"]
        helper = /path/to/helper

The problem is that LFS loads the cred helpers when an *lfsapi.Client is initialized:

git-lfs/lfsapi/lfsapi.go

Lines 69 to 72 in 3480fa4

creds, err := getCredentialHelper(osEnv, gitEnv)
if err != nil {
return nil, errors.Wrap(err, "cannot find credential helper(s)")
}

Instead, it needs to happen at request time here, using *config.URLConfig:

git-lfs/lfsapi/auth.go

Lines 23 to 27 in 3480fa4

func (c *Client) DoWithAuth(remote string, req *http.Request) (*http.Response, error) {
credHelper := c.Credentials
if credHelper == nil {
credHelper = defaultCredentialHelper
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions