Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Commits on Jul 18, 2012
  1. @peff @gitster

    credential: convert "url" attribute into its parsed subparts

    peff authored gitster committed
    The git-credential command requires that you feed it a
    broken-down credential, which means that the client needs to
    parse a URL itself. Since we have our own URL-parsing
    routines, we can easily allow the caller to just give us the
    URL as-is, saving them some code.
    Signed-off-by: Jeff King <>
    Acked-by: Matthieu Moy <>
    Signed-off-by: Junio C Hamano <>
Commits on Jun 25, 2012
  1. @moy @gitster

    git credential fill: output the whole 'struct credential'

    moy authored gitster committed
    Instead of outputing only the username and password, print all the
    attributes, even those that already appeared in the input.
    This is closer to what the C API does, and allows one to take the exact
    output of "git credential fill" as input to "git credential approve" or
    "git credential reject".
    Signed-off-by: Junio C Hamano <>
Commits on Dec 13, 2011
  1. @peff @gitster

    credential: use git_prompt instead of git_getpass

    peff authored gitster committed
    We use git_getpass to retrieve the username and password
    from the terminal. However, git_getpass will not echo the
    username as the user types. We can fix this by using the
    more generic git_prompt, which underlies git_getpass but
    lets us specify an "echo" option.
    Signed-off-by: Jeff King <>
    Signed-off-by: Junio C Hamano <>
  2. @peff @gitster

    move git_getpass to its own source file

    peff authored gitster committed
    This is currently in connect.c, but really has nothing to
    do with the git protocol itself. Let's make a new source
    file all about prompting the user, which will make it
    cleaner to refactor.
    Signed-off-by: Jeff King <>
    Signed-off-by: Junio C Hamano <>
Commits on Dec 12, 2011
  1. @peff @gitster

    credential: make relevance of http path configurable

    peff authored gitster committed
    When parsing a URL into a credential struct, we carefully
    record each part of the URL, including the path on the
    remote host, and use the result as part of the credential
    This had two practical implications:
      1. Credential helpers which store a credential for later
         access are likely to use the "path" portion as part of
         the storage key. That means that a request to
         would not use the same credential that was stored in an
         earlier request for:
      2. The prompt shown to the user includes all relevant
         context, including the path.
    In most cases, however, users will have a single password
    per host. The behavior in (1) will be inconvenient, and the
    prompt in (2) will be overly long.
    This patch introduces a config option to toggle the
    relevance of http paths. When turned on, we use the path as
    before. When turned off, we drop the path component from the
    context: helpers don't see it, and it does not appear in the
    This is nothing you couldn't do with a clever credential
    helper at the start of your stack, like:
      [credential "http://"]
    	helper = "!f() { grep -v ^path= ; }; f"
    	helper = your_real_helper
    But doing this:
    	useHttpPath = false
    is way easier and more readable. Furthermore, since most
    users will want the "off" behavior, that is the new default.
    Users who want it "on" can set the variable (either for all
    credentials, or just for a subset using
    Signed-off-by: Jeff King <>
    Signed-off-by: Junio C Hamano <>
  2. @peff @gitster

    credential: add credential.*.username

    peff authored gitster committed
    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 <>
    Signed-off-by: Junio C Hamano <>
  3. @peff @gitster

    credential: apply helper config

    peff authored gitster committed
    The functionality for credential storage helpers is already
    there; we just need to give the users a way to turn it on.
    This patch provides a "credential.helper" configuration
    variable which allows the user to provide one or more helper
    Rather than simply matching credential.helper, we will also
    compare URLs in subsection headings to the current context.
    This means you can apply configuration to a subset of
    credentials. For example:
      [credential ""]
    	helper = foo
    would match a request for "", but
    not one for "".
    This is overkill for the "helper" variable, since users are
    unlikely to want different helpers for different sites (and
    since helpers run arbitrary code, they could do the matching
    themselves anyway).
    However, future patches will add new config variables where
    this extra feature will be more useful.
    Signed-off-by: Jeff King <>
    Signed-off-by: Junio C Hamano <>
  4. @peff @gitster

    credential: add function for parsing url components

    peff authored gitster committed
    All of the components of a credential struct can be found in
    a URL.  For example, the URL:
    We want to be able to turn URLs into broken-down credential
    structs so that we know two things:
      1. Which parts of the username/password we still need
      2. What the context of the request is (for prompting or
         as a key for storing credentials).
    This code is based on http_auth_init in http.c, but needed a
    few modifications in order to get all of the components that
    the credential object is interested in.
    Once the http code is switched over to the credential API,
    then http_auth_init can just go away.
    Signed-off-by: Jeff King <>
    Signed-off-by: Junio C Hamano <>
  5. @peff @gitster

    introduce credentials API

    peff authored gitster committed
    There are a few places in git that need to get a username
    and password credential from the user; the most notable one
    is HTTP authentication for smart-http pushing.
    Right now the only choices for providing credentials are to
    put them plaintext into your ~/.netrc, or to have git prompt
    you (either on the terminal or via an askpass program). The
    former is not very secure, and the latter is not very
    Unfortunately, there is no "always best" solution for
    password management. The details will depend on the tradeoff
    you want between security and convenience, as well as how
    git can integrate with other security systems (e.g., many
    operating systems provide a keychain or password wallet for
    single sign-on).
    This patch provides an abstract notion of credentials as a
    data item, and provides three basic operations:
      - fill (i.e., acquire from external storage or from the
      - approve (mark a credential as "working" for further
      - reject (mark a credential as "not working", so it can
        be removed from storage)
    These operations can be backed by external helper processes
    that interact with system- or user-specific secure storage.
    Signed-off-by: Jeff King <>
    Signed-off-by: Junio C Hamano <>
Something went wrong with that request. Please try again.