1GIT-CREDENTIAL(1)                 Git Manual                 GIT-CREDENTIAL(1)
2
3
4

NAME

6       git-credential - Retrieve and store user credentials
7

SYNOPSIS

9       git credential <fill|approve|reject>
10

DESCRIPTION

12       Git has an internal interface for storing and retrieving credentials
13       from system-specific helpers, as well as prompting the user for
14       usernames and passwords. The git-credential command exposes this
15       interface to scripts which may want to retrieve, store, or prompt for
16       credentials in the same manner as Git. The design of this scriptable
17       interface models the internal C API; see credential.h for more
18       background on the concepts.
19
20       git-credential takes an "action" option on the command-line (one of
21       fill, approve, or reject) and reads a credential description on stdin
22       (see INPUT/OUTPUT FORMAT).
23
24       If the action is fill, git-credential will attempt to add "username"
25       and "password" attributes to the description by reading config files,
26       by contacting any configured credential helpers, or by prompting the
27       user. The username and password attributes of the credential
28       description are then printed to stdout together with the attributes
29       already provided.
30
31       If the action is approve, git-credential will send the description to
32       any configured credential helpers, which may store the credential for
33       later use.
34
35       If the action is reject, git-credential will send the description to
36       any configured credential helpers, which may erase any stored
37       credential matching the description.
38
39       If the action is approve or reject, no output should be emitted.
40

TYPICAL USE OF GIT CREDENTIAL

42       An application using git-credential will typically use git credential
43       following these steps:
44
45        1. Generate a credential description based on the context.
46
47           For example, if we want a password for https://example.com/foo.git,
48           we might generate the following credential description (don’t
49           forget the blank line at the end; it tells git credential that the
50           application finished feeding all the information it has):
51
52               protocol=https
53               host=example.com
54               path=foo.git
55
56        2. Ask git-credential to give us a username and password for this
57           description. This is done by running git credential fill, feeding
58           the description from step (1) to its standard input. The complete
59           credential description (including the credential per se, i.e. the
60           login and password) will be produced on standard output, like:
61
62               protocol=https
63               host=example.com
64               username=bob
65               password=secr3t
66
67           In most cases, this means the attributes given in the input will be
68           repeated in the output, but Git may also modify the credential
69           description, for example by removing the path attribute when the
70           protocol is HTTP(s) and credential.useHttpPath is false.
71
72           If the git credential knew about the password, this step may not
73           have involved the user actually typing this password (the user may
74           have typed a password to unlock the keychain instead, or no user
75           interaction was done if the keychain was already unlocked) before
76           it returned password=secr3t.
77
78        3. Use the credential (e.g., access the URL with the username and
79           password from step (2)), and see if it’s accepted.
80
81        4. Report on the success or failure of the password. If the credential
82           allowed the operation to complete successfully, then it can be
83           marked with an "approve" action to tell git credential to reuse it
84           in its next invocation. If the credential was rejected during the
85           operation, use the "reject" action so that git credential will ask
86           for a new password in its next invocation. In either case, git
87           credential should be fed with the credential description obtained
88           from step (2) (which also contain the ones provided in step (1)).
89

INPUT/OUTPUT FORMAT

91       git credential reads and/or writes (depending on the action used)
92       credential information in its standard input/output. This information
93       can correspond either to keys for which git credential will obtain the
94       login/password information (e.g. host, protocol, path), or to the
95       actual credential data to be obtained (login/password).
96
97       The credential is split into a set of named attributes, with one
98       attribute per line. Each attribute is specified by a key-value pair,
99       separated by an = (equals) sign, followed by a newline. The key may
100       contain any bytes except =, newline, or NUL. The value may contain any
101       bytes except newline or NUL. In both cases, all bytes are treated as-is
102       (i.e., there is no quoting, and one cannot transmit a value with
103       newline or NUL in it). The list of attributes is terminated by a blank
104       line or end-of-file. Git understands the following attributes:
105
106       protocol
107           The protocol over which the credential will be used (e.g., https).
108
109       host
110           The remote hostname for a network credential.
111
112       path
113           The path with which the credential will be used. E.g., for
114           accessing a remote https repository, this will be the repository’s
115           path on the server.
116
117       username
118           The credential’s username, if we already have one (e.g., from a
119           URL, from the user, or from a previously run helper).
120
121       password
122           The credential’s password, if we are asking it to be stored.
123
124       url
125           When this special attribute is read by git credential, the value is
126           parsed as a URL and treated as if its constituent parts were read
127           (e.g., url=https://example.com would behave as if protocol=https
128           and host=example.com had been provided). This can help callers
129           avoid parsing URLs themselves. Note that any components which are
130           missing from the URL (e.g., there is no username in the example
131           above) will be set to empty; if you want to provide a URL and
132           override some attributes, provide the URL attribute first, followed
133           by any overrides.
134
135
136
137Git 2.26.2                        2020-04-20                 GIT-CREDENTIAL(1)
Impressum