{
    "content": [
        {
            "type": "text",
            "text": "# gitcredentials(7) (man)\n\n**Summary:** gitcredentials - Providing usernames and passwords to Git\n\n**Synopsis:** git config credential.https://example.com.username myusername\ngit config credential.helper \"$helper $options\"\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (4 lines)\n- **DESCRIPTION** (5 lines)\n- **REQUESTING CREDENTIALS** (13 lines)\n- **AVOIDING REPETITION** (49 lines)\n- **CREDENTIAL CONTEXTS** (31 lines)\n- **CONFIGURATION OPTIONS** (29 lines)\n- **CUSTOM HELPERS** (56 lines) — 3 subsections\n  - get (2 lines)\n  - store (2 lines)\n  - erase (32 lines)\n- **GIT** (5 lines)\n\n## Full Content\n\n### NAME\n\ngitcredentials - Providing usernames and passwords to Git\n\n### SYNOPSIS\n\ngit config credential.https://example.com.username myusername\ngit config credential.helper \"$helper $options\"\n\n### DESCRIPTION\n\nGit will sometimes need credentials from the user in order to perform operations; for\nexample, it may need to ask for a username and password in order to access a remote\nrepository over HTTP. This manual describes the mechanisms Git uses to request these\ncredentials, as well as some features to avoid inputting these credentials repeatedly.\n\n### REQUESTING CREDENTIALS\n\nWithout any credential helpers defined, Git will try the following strategies to ask the user\nfor usernames and passwords:\n\n1. If the GITASKPASS environment variable is set, the program specified by the variable is\ninvoked. A suitable prompt is provided to the program on the command line, and the user’s\ninput is read from its standard output.\n\n2. Otherwise, if the core.askPass configuration variable is set, its value is used as above.\n\n3. Otherwise, if the SSHASKPASS environment variable is set, its value is used as above.\n\n4. Otherwise, the user is prompted on the terminal.\n\n### AVOIDING REPETITION\n\nIt can be cumbersome to input the same credentials over and over. Git provides two methods to\nreduce this annoyance:\n\n1. Static configuration of usernames for a given authentication context.\n\n2. Credential helpers to cache or store passwords, or to interact with a system password\nwallet or keychain.\n\nThe first is simple and appropriate if you do not have secure storage available for a\npassword. It is generally configured by adding this to your config:\n\n[credential \"https://example.com\"]\nusername = me\n\n\nCredential helpers, on the other hand, are external programs from which Git can request both\nusernames and passwords; they typically interface with secure storage provided by the OS or\nother programs.\n\nTo use a helper, you must first select one to use. Git currently includes the following\nhelpers:\n\ncache\nCache credentials in memory for a short period of time. See git-credential-cache(1) for\ndetails.\n\nstore\nStore credentials indefinitely on disk. See git-credential-store(1) for details.\n\nYou may also have third-party helpers installed; search for credential-* in the output of git\nhelp -a, and consult the documentation of individual helpers. Once you have selected a\nhelper, you can tell Git to use it by putting its name into the credential.helper variable.\n\n1. Find a helper.\n\n$ git help -a | grep credential-\ncredential-foo\n\n\n2. Read its description.\n\n$ git help credential-foo\n\n\n3. Tell Git to use it.\n\n$ git config --global credential.helper foo\n\n### CREDENTIAL CONTEXTS\n\nGit considers each credential to have a context defined by a URL. This context is used to\nlook up context-specific configuration, and is passed to any helpers, which may use it as an\nindex into secure storage.\n\nFor instance, imagine we are accessing https://example.com/foo.git. When Git looks into a\nconfig file to see if a section matches this context, it will consider the two a match if the\ncontext is a more-specific subset of the pattern in the config file. For example, if you have\nthis in your config file:\n\n[credential \"https://example.com\"]\nusername = foo\n\n\nthen we will match: both protocols are the same, both hosts are the same, and the \"pattern\"\nURL does not care about the path component at all. However, this context would not match:\n\n[credential \"https://kernel.org\"]\nusername = foo\n\n\nbecause the hostnames differ. Nor would it match foo.example.com; Git compares hostnames\nexactly, without considering whether two hosts are part of the same domain. Likewise, a\nconfig entry for http://example.com would not match: Git compares the protocols exactly.\nHowever, you may use wildcards in the domain name and other pattern matching techniques as\nwith the http.<url>.* options.\n\nIf the \"pattern\" URL does include a path component, then this too must match exactly: the\ncontext https://example.com/bar/baz.git will match a config entry for\nhttps://example.com/bar/baz.git (in addition to matching the config entry for\nhttps://example.com) but will not match a config entry for https://example.com/bar.\n\n### CONFIGURATION OPTIONS\n\nOptions for a credential context can be configured either in credential.* (which applies to\nall credentials), or credential.<url>.*, where <url> matches the context as described above.\n\nThe following options are available in either location:\n\nhelper\nThe name of an external credential helper, and any associated options. If the helper name\nis not an absolute path, then the string git credential- is prepended. The resulting\nstring is executed by the shell (so, for example, setting this to foo --option=bar will\nexecute git credential-foo --option=bar via the shell. See the manual of specific helpers\nfor examples of their use.\n\nIf there are multiple instances of the credential.helper configuration variable, each\nhelper will be tried in turn, and may provide a username, password, or nothing. Once Git\nhas acquired both a username and a password, no more helpers will be tried.\n\nIf credential.helper is configured to the empty string, this resets the helper list to\nempty (so you may override a helper set by a lower-priority config file by configuring\nthe empty-string helper, followed by whatever set of helpers you would like).\n\nusername\nA default username, if one is not provided in the URL.\n\nuseHttpPath\nBy default, Git does not consider the \"path\" component of an http URL to be worth\nmatching via external helpers. This means that a credential stored for\nhttps://example.com/foo.git will also be used for https://example.com/bar.git. If you do\nwant to distinguish these cases, set this option to true.\n\n### CUSTOM HELPERS\n\nYou can write your own custom helpers to interface with any system in which you keep\ncredentials.\n\nCredential helpers are programs executed by Git to fetch or save credentials from and to\nlong-term storage (where \"long-term\" is simply longer than a single Git process; e.g.,\ncredentials may be stored in-memory for a few minutes, or indefinitely on disk).\n\nEach helper is specified by a single string in the configuration variable credential.helper\n(and others, see git-config(1)). The string is transformed by Git into a command to be\nexecuted using these rules:\n\n1. If the helper string begins with \"!\", it is considered a shell snippet, and everything\nafter the \"!\" becomes the command.\n\n2. Otherwise, if the helper string begins with an absolute path, the verbatim helper string\nbecomes the command.\n\n3. Otherwise, the string \"git credential-\" is prepended to the helper string, and the result\nbecomes the command.\n\nThe resulting command then has an \"operation\" argument appended to it (see below for\ndetails), and the result is executed by the shell.\n\nHere are some example specifications:\n\n# run \"git credential-foo\"\n[credential]\nhelper = foo\n\n# same as above, but pass an argument to the helper\n[credential]\nhelper = \"foo --bar=baz\"\n\n# the arguments are parsed by the shell, so use shell\n# quoting if necessary\n[credential]\nhelper = \"foo --bar='whitespace arg'\"\n\n# you can also use an absolute path, which will not use the git wrapper\n[credential]\nhelper = \"/path/to/my/helper --with-arguments\"\n\n# or you can specify your own shell snippet\n[credential \"https://example.com\"]\nusername = youruser\nhelper = \"!f() { test \\\"$1\\\" = get && echo \\\"password=$(cat $HOME/.secret)\\\"; }; f\"\n\n\nGenerally speaking, rule (3) above is the simplest for users to specify. Authors of\ncredential helpers should make an effort to assist their users by naming their program\n\"git-credential-$NAME\", and putting it in the $PATH or $GITEXECPATH during installation,\nwhich will allow a user to enable it with git config credential.helper $NAME.\n\nWhen a helper is executed, it will have one \"operation\" argument appended to its command\nline, which is one of:\n\n#### get\n\nReturn a matching credential, if any exists.\n\n#### store\n\nStore the credential, if applicable to the helper.\n\n#### erase\n\nRemove a matching credential, if any, from the helper’s storage.\n\nThe details of the credential will be provided on the helper’s stdin stream. The exact format\nis the same as the input/output format of the git credential plumbing command (see the\nsection INPUT/OUTPUT FORMAT in git-credential(1) for a detailed specification).\n\nFor a get operation, the helper should produce a list of attributes on stdout in the same\nformat (see git-credential(1) for common attributes). A helper is free to produce a subset,\nor even no values at all if it has nothing useful to provide. Any provided attributes will\noverwrite those already known about by Git’s credential subsystem.\n\nWhile it is possible to override all attributes, well behaving helpers should refrain from\ndoing so for any attribute other than username and password.\n\nIf a helper outputs a quit attribute with a value of true or 1, no further helpers will be\nconsulted, nor will the user be prompted (if no credential has been provided, the operation\nwill then fail).\n\nSimilarly, no more helpers will be consulted once both username and password had been\nprovided.\n\nFor a store or erase operation, the helper’s output is ignored.\n\nIf a helper fails to perform the requested operation or needs to notify the user of a\npotential issue, it may write to stderr.\n\nIf it does not support the requested operation (e.g., a read-only store), it should silently\nignore the request.\n\nIf a helper receives any other operation, it should silently ignore the request. This leaves\nroom for future operations to be added (older helpers will just ignore the new requests).\n\n### GIT\n\nPart of the git(1) suite\n\n\n\nGit 2.34.1                                   02/26/2026                            GITCREDENTIALS(7)\n\n"
        }
    ],
    "structuredContent": {
        "command": "gitcredentials",
        "section": "7",
        "mode": "man",
        "summary": "gitcredentials - Providing usernames and passwords to Git",
        "synopsis": "git config credential.https://example.com.username myusername\ngit config credential.helper \"$helper $options\"",
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "REQUESTING CREDENTIALS",
                "lines": 13,
                "subsections": []
            },
            {
                "name": "AVOIDING REPETITION",
                "lines": 49,
                "subsections": []
            },
            {
                "name": "CREDENTIAL CONTEXTS",
                "lines": 31,
                "subsections": []
            },
            {
                "name": "CONFIGURATION OPTIONS",
                "lines": 29,
                "subsections": []
            },
            {
                "name": "CUSTOM HELPERS",
                "lines": 56,
                "subsections": [
                    {
                        "name": "get",
                        "lines": 2
                    },
                    {
                        "name": "store",
                        "lines": 2
                    },
                    {
                        "name": "erase",
                        "lines": 32
                    }
                ]
            },
            {
                "name": "GIT",
                "lines": 5,
                "subsections": []
            }
        ]
    }
}