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 information (e.g. host, protocol, path), or to the actual
95       credential data to be obtained (username/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.
100
101       The key may contain any bytes except =, newline, or NUL. The value may
102       contain any bytes except newline or NUL.
103
104       In both cases, all bytes are treated as-is (i.e., there is no quoting,
105       and one cannot transmit a value with newline or NUL in it). The list of
106       attributes is terminated by a blank line or end-of-file.
107
108       Git understands the following attributes:
109
110       protocol
111           The protocol over which the credential will be used (e.g., https).
112
113       host
114           The remote hostname for a network credential. This includes the
115           port number if one was specified (e.g., "example.com:8088").
116
117       path
118           The path with which the credential will be used. E.g., for
119           accessing a remote https repository, this will be the repository’s
120           path on the server.
121
122       username
123           The credential’s username, if we already have one (e.g., from a
124           URL, the configuration, the user, or from a previously run helper).
125
126       password
127           The credential’s password, if we are asking it to be stored.
128
129       url
130           When this special attribute is read by git credential, the value is
131           parsed as a URL and treated as if its constituent parts were read
132           (e.g., url=https://example.com would behave as if protocol=https
133           and host=example.com had been provided). This can help callers
134           avoid parsing URLs themselves.
135
136           Note that specifying a protocol is mandatory and if the URL doesn’t
137           specify a hostname (e.g., "cert:///path/to/file") the credential
138           will contain a hostname attribute whose value is an empty string.
139
140           Components which are missing from the URL (e.g., there is no
141           username in the example above) will be left unset.
142
143
144
145Git 2.30.2                        2021-03-08                 GIT-CREDENTIAL(1)
Impressum