Updated git_doc to git 1.8
[TortoiseGit.git] / doc / source / en / TortoiseGit / git_doc / git-credential.xml
blobe7688835b8eb1e83203d7d6e53c835a7d3b13e15
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!DOCTYPE sect2 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">\r
3 \r
4 <sect2 lang="en" id="git-credential(1)">\r
5     <title>git-credential(1)</title>\r
6 <indexterm>\r
7 <primary>git-credential(1)</primary>\r
8 </indexterm>\r
9 <simplesect id="git-credential(1)__name">\r
10 <title>NAME</title>\r
11 <simpara>git-credential - Retrieve and store user credentials</simpara>\r
12 </simplesect>\r
13 <simplesect id="git-credential(1)__synopsis">\r
14 <title>SYNOPSIS</title>\r
15 <screen>git credential &lt;fill|approve|reject&gt;</screen>\r
16 </simplesect>\r
17 <simplesect id="git-credential(1)__description">\r
18 <title>DESCRIPTION</title>\r
19 <simpara>Git has an internal interface for storing and retrieving credentials\r
20 from system-specific helpers, as well as prompting the user for\r
21 usernames and passwords. The git-credential command exposes this\r
22 interface to scripts which may want to retrieve, store, or prompt for\r
23 credentials in the same manner as git. The design of this scriptable\r
24 interface models the internal C API; see\r
25 link:technical/api-credentials.txt[the git credential API] for more\r
26 background on the concepts.</simpara>\r
27 <simpara>git-credential takes an "action" option on the command-line (one of\r
28 <emphasis>fill</emphasis>, <emphasis>approve</emphasis>, or <emphasis>reject</emphasis>) and reads a credential description\r
29 on stdin (see <link linkend="git-credential(1)_IOFMT">INPUT/OUTPUT FORMAT</link>).</simpara>\r
30 <simpara>If the action is <emphasis>fill</emphasis>, git-credential will attempt to add "username"\r
31 and "password" attributes to the description by reading config files,\r
32 by contacting any configured credential helpers, or by prompting the\r
33 user. The username and password attributes of the credential\r
34 description are then printed to stdout together with the attributes\r
35 already provided.</simpara>\r
36 <simpara>If the action is <emphasis>approve</emphasis>, git-credential will send the description\r
37 to any configured credential helpers, which may store the credential\r
38 for later use.</simpara>\r
39 <simpara>If the action is <emphasis>reject</emphasis>, git-credential will send the description to\r
40 any configured credential helpers, which may erase any stored\r
41 credential matching the description.</simpara>\r
42 <simpara>If the action is <emphasis>approve</emphasis> or <emphasis>reject</emphasis>, no output should be emitted.</simpara>\r
43 </simplesect>\r
44 <simplesect id="git-credential(1)__typical_use_of_git_credential">\r
45 <title>TYPICAL USE OF GIT CREDENTIAL</title>\r
46 <simpara>An application using git-credential will typically use <emphasis>git\r
47 credential</emphasis> following these steps:</simpara>\r
48 <orderedlist numeration="arabic">\r
49 <listitem>\r
50 <simpara>\r
51 Generate a credential description based on the context.\r
52 </simpara>\r
53 <simpara>For example, if we want a password for\r
54 <emphasis>https://example.com/foo.git</emphasis>, we might generate the following\r
55 credential description (don't forget the blank line at the end; it\r
56 tells <emphasis>git credential</emphasis> that the application finished feeding all the\r
57 infomation it has):</simpara>\r
58 <literallayout class="monospaced">protocol=https\r
59 host=example.com\r
60 path=foo.git</literallayout>\r
61 </listitem>\r
62 <listitem>\r
63 <simpara>\r
64 Ask git-credential to give us a username and password for this\r
65      description. This is done by running <emphasis>git credential fill</emphasis>,\r
66      feeding the description from step (1) to its standard input. The complete\r
67      credential description (including the credential per se, i.e. the\r
68      login and password) will be produced on standard output, like:\r
69 </simpara>\r
70 <literallayout class="monospaced">protocol=https\r
71 host=example.com\r
72 username=bob\r
73 password=secr3t</literallayout>\r
74 <simpara>In most cases, this means the attributes given in the input will be\r
75 repeated in the output, but git may also modify the credential\r
76 description, for example by removing the <emphasis>path</emphasis> attribute when the\r
77 protocol is HTTP(s) and <emphasis>credential.useHttpPath</emphasis> is false.</simpara>\r
78 <simpara>If the <emphasis>git credential</emphasis> knew about the password, this step may\r
79 not have involved the user actually typing this password (the\r
80 user may have typed a password to unlock the keychain instead,\r
81 or no user interaction was done if the keychain was already\r
82 unlocked) before it returned <emphasis>password=secr3t</emphasis>.</simpara>\r
83 </listitem>\r
84 <listitem>\r
85 <simpara>\r
86 Use the credential (e.g., access the URL with the username and\r
87      password from step (2)), and see if it's accepted.\r
88 </simpara>\r
89 </listitem>\r
90 <listitem>\r
91 <simpara>\r
92 Report on the success or failure of the password. If the\r
93      credential allowed the operation to complete successfully, then\r
94      it can be marked with an "approve" action to tell <emphasis>git\r
95      credential</emphasis> to reuse it in its next invocation. If the credential\r
96      was rejected during the operation, use the "reject" action so\r
97      that <emphasis>git credential</emphasis> will ask for a new password in its next\r
98      invocation. In either case, <emphasis>git credential</emphasis> should be fed with\r
99      the credential description obtained from step (2) (which also\r
100      contain the ones provided in step (1)).\r
101 </simpara>\r
102 </listitem>\r
103 </orderedlist>\r
104 </simplesect>\r
105 <simplesect id="git-credential(1)_IOFMT">\r
106 <title>INPUT/OUTPUT FORMAT</title>\r
107 <simpara><emphasis>git credential</emphasis> reads and/or writes (depending on the action used)\r
108 credential information in its standard input/output. This information\r
109 can correspond either to keys for which <emphasis>git credential</emphasis> will obtain\r
110 the login/password information (e.g. host, protocol, path), or to the\r
111 actual credential data to be obtained (login/password).</simpara>\r
112 <simpara>The credential is split into a set of named attributes, with one\r
113 attribute per line. Each attribute is\r
114 specified by a key-value pair, separated by an <emphasis>=</emphasis> (equals) sign,\r
115 followed by a newline. The key may contain any bytes except <emphasis>=</emphasis>,\r
116 newline, or NUL. The value may contain any bytes except newline or NUL.\r
117 In both cases, all bytes are treated as-is (i.e., there is no quoting,\r
118 and one cannot transmit a value with newline or NUL in it). The list of\r
119 attributes is terminated by a blank line or end-of-file.\r
120 Git understands the following attributes:</simpara>\r
121 <variablelist>\r
122 <varlistentry>\r
123 <term>\r
124 <emphasis>protocol</emphasis>\r
125 </term>\r
126 <listitem>\r
127 <simpara>\r
128         The protocol over which the credential will be used (e.g.,\r
129         <emphasis>https</emphasis>).\r
130 </simpara>\r
131 </listitem>\r
132 </varlistentry>\r
133 <varlistentry>\r
134 <term>\r
135 <emphasis>host</emphasis>\r
136 </term>\r
137 <listitem>\r
138 <simpara>\r
139         The remote hostname for a network credential.\r
140 </simpara>\r
141 </listitem>\r
142 </varlistentry>\r
143 <varlistentry>\r
144 <term>\r
145 <emphasis>path</emphasis>\r
146 </term>\r
147 <listitem>\r
148 <simpara>\r
149         The path with which the credential will be used. E.g., for\r
150         accessing a remote https repository, this will be the\r
151         repository's path on the server.\r
152 </simpara>\r
153 </listitem>\r
154 </varlistentry>\r
155 <varlistentry>\r
156 <term>\r
157 <emphasis>username</emphasis>\r
158 </term>\r
159 <listitem>\r
160 <simpara>\r
161         The credential's username, if we already have one (e.g., from a\r
162         URL, from the user, or from a previously run helper).\r
163 </simpara>\r
164 </listitem>\r
165 </varlistentry>\r
166 <varlistentry>\r
167 <term>\r
168 <emphasis>password</emphasis>\r
169 </term>\r
170 <listitem>\r
171 <simpara>\r
172         The credential's password, if we are asking it to be stored.\r
173 </simpara>\r
174 </listitem>\r
175 </varlistentry>\r
176 <varlistentry>\r
177 <term>\r
178 <emphasis>url</emphasis>\r
179 </term>\r
180 <listitem>\r
181 <simpara>\r
182         When this special attribute is read by <emphasis>git credential</emphasis>, the\r
183         value is parsed as a URL and treated as if its constituent parts\r
184         were read (e.g., <emphasis>url=https://example.com</emphasis> would behave as if\r
185         <emphasis>protocol=https</emphasis> and <emphasis>host=example.com</emphasis> had been provided). This\r
186         can help callers avoid parsing URLs themselves.  Note that any\r
187         components which are missing from the URL (e.g., there is no\r
188         username in the example above) will be set to empty; if you want\r
189         to provide a URL and override some attributes, provide the URL\r
190         attribute first, followed by any overrides.\r
191 </simpara>\r
192 </listitem>\r
193 </varlistentry>\r
194 </variablelist>\r
195 </simplesect>\r
196 </sect2>\r