updated git doc
[TortoiseGit.git] / doc / source / en / TortoiseGit / git_doc / git-cvsserver.xml
blobcb92a1283bef33b9a56799eb8ce6919d318beeba
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">\r
3 \r
4 <article lang="en" id="git-cvsserver(1)">\r
5 <articleinfo>\r
6     <title>git-cvsserver(1)</title>\r
7 <indexterm>\r
8 <primary>git-cvsserver(1)</primary>\r
9 </indexterm>\r
10 </articleinfo>\r
11 <simplesect id="_name">\r
12 <title>NAME</title>\r
13 <simpara>git-cvsserver - A CVS server emulator for git</simpara>\r
14 </simplesect>\r
15 <simplesect id="_synopsis">\r
16 <title>SYNOPSIS</title>\r
17 <simpara>SSH:</simpara>\r
18 <blockquote>\r
19 <literallayout>export CVS_SERVER="git cvsserver"\r
20 <emphasis>cvs</emphasis> -d :ext:user@server/path/repo.git co &lt;HEAD_name&gt;</literallayout>\r
21 </blockquote>\r
22 <simpara>pserver (/etc/inetd.conf):</simpara>\r
23 <blockquote>\r
24 <literallayout>cvspserver stream tcp nowait nobody /usr/bin/git-cvsserver git-cvsserver pserver</literallayout>\r
25 </blockquote>\r
26 <simpara>Usage:</simpara>\r
27 <blockquote>\r
28 <literallayout><emphasis>git-cvsserver</emphasis> [options] [pserver|server] [&lt;directory&gt; &#8230;]</literallayout>\r
29 </blockquote>\r
30 </simplesect>\r
31 <simplesect id="_options">\r
32 <title>OPTIONS</title>\r
33 <simpara>All these options obviously only make sense if enforced by the server side.\r
34 They have been implemented to resemble the <xref linkend="git-daemon(1)" /> options as\r
35 closely as possible.</simpara>\r
36 <variablelist>\r
37 <varlistentry>\r
38 <term>\r
39 --base-path &lt;path&gt;\r
40 </term>\r
41 <listitem>\r
42 <simpara>\r
43 Prepend <emphasis>path</emphasis> to requested CVSROOT\r
44 </simpara>\r
45 </listitem>\r
46 </varlistentry>\r
47 <varlistentry>\r
48 <term>\r
49 --strict-paths\r
50 </term>\r
51 <listitem>\r
52 <simpara>\r
53 Don't allow recursing into subdirectories\r
54 </simpara>\r
55 </listitem>\r
56 </varlistentry>\r
57 <varlistentry>\r
58 <term>\r
59 --export-all\r
60 </term>\r
61 <listitem>\r
62 <simpara>\r
63 Don't check for <emphasis>gitcvs.enabled</emphasis> in config. You also have to specify a list\r
64 of allowed directories (see below) if you want to use this option.\r
65 </simpara>\r
66 </listitem>\r
67 </varlistentry>\r
68 <varlistentry>\r
69 <term>\r
70 -V\r
71 </term>\r
72 <term>\r
73 --version\r
74 </term>\r
75 <listitem>\r
76 <simpara>\r
77 Print version information and exit\r
78 </simpara>\r
79 </listitem>\r
80 </varlistentry>\r
81 <varlistentry>\r
82 <term>\r
83 -h\r
84 </term>\r
85 <term>\r
86 -H\r
87 </term>\r
88 <term>\r
89 --help\r
90 </term>\r
91 <listitem>\r
92 <simpara>\r
93 Print usage information and exit\r
94 </simpara>\r
95 </listitem>\r
96 </varlistentry>\r
97 <varlistentry>\r
98 <term>\r
99 &lt;directory&gt;\r
100 </term>\r
101 <listitem>\r
102 <simpara>\r
103 You can specify a list of allowed directories. If no directories\r
104 are given, all are allowed. This is an additional restriction, gitcvs\r
105 access still needs to be enabled by the <emphasis>gitcvs.enabled</emphasis> config option\r
106 unless <emphasis>--export-all</emphasis> was given, too.\r
107 </simpara>\r
108 </listitem>\r
109 </varlistentry>\r
110 </variablelist>\r
111 </simplesect>\r
112 <simplesect id="_description">\r
113 <title>DESCRIPTION</title>\r
114 <simpara>This application is a CVS emulation layer for git.</simpara>\r
115 <simpara>It is highly functional. However, not all methods are implemented,\r
116 and for those methods that are implemented,\r
117 not all switches are implemented.</simpara>\r
118 <simpara>Testing has been done using both the CLI CVS client, and the Eclipse CVS\r
119 plugin. Most functionality works fine with both of these clients.</simpara>\r
120 </simplesect>\r
121 <simplesect id="_limitations">\r
122 <title>LIMITATIONS</title>\r
123 <simpara>CVS clients cannot tag, branch or perform GIT merges.</simpara>\r
124 <simpara><emphasis>git-cvsserver</emphasis> maps GIT branches to CVS modules. This is very different\r
125 from what most CVS users would expect since in CVS modules usually represent\r
126 one or more directories.</simpara>\r
127 </simplesect>\r
128 <simplesect id="_installation">\r
129 <title>INSTALLATION</title>\r
130 <orderedlist numeration="arabic">\r
131 <listitem>\r
132 <simpara>\r
133 If you are going to offer CVS access via pserver, add a line in\r
134    /etc/inetd.conf like\r
135 </simpara>\r
136 <screen>   cvspserver stream tcp nowait nobody git-cvsserver pserver</screen>\r
137 <simpara>Note: Some inetd servers let you specify the name of the executable\r
138 independently of the value of argv[0] (i.e. the name the program assumes\r
139 it was executed with). In this case the correct line in /etc/inetd.conf\r
140 looks like</simpara>\r
141 <screen>   cvspserver stream tcp nowait nobody /usr/bin/git-cvsserver git-cvsserver pserver</screen>\r
142 <simpara>Only anonymous access is provided by pserve by default. To commit you\r
143 will have to create pserver accounts, simply add a gitcvs.authdb\r
144 setting in the config file of the repositories you want the cvsserver\r
145 to allow writes to, for example:</simpara>\r
146 <screen>   [gitcvs]\r
147         authdb = /etc/cvsserver/passwd</screen>\r
148 <simpara>The format of these files is username followed by the crypted password,\r
149 for example:</simpara>\r
150 <screen>   myuser:$1Oyx5r9mdGZ2\r
151    myuser:$1$BA)@$vbnMJMDym7tA32AamXrm./</screen>\r
152 <simpara>You can use the <emphasis>htpasswd</emphasis> facility that comes with Apache to make these\r
153 files, but Apache's MD5 crypt method differs from the one used by most C\r
154 library's crypt() function, so don't use the -m option.</simpara>\r
155 <simpara>Alternatively you can produce the password with perl's crypt() operator:</simpara>\r
156 <screen>   perl -e 'my ($user, $pass) = @ARGV; printf "%s:%s\n", $user, crypt($user, $pass)' $USER password</screen>\r
157 <simpara>Then provide your password via the pserver method, for example:</simpara>\r
158 <screen>   cvs -d:pserver:someuser:somepassword &lt;at&gt; server/path/repo.git co &lt;HEAD_name&gt;</screen>\r
159 <simpara>No special setup is needed for SSH access, other than having GIT tools\r
160 in the PATH. If you have clients that do not accept the CVS_SERVER\r
161 environment variable, you can rename <emphasis>git-cvsserver</emphasis> to <emphasis>cvs</emphasis>.</simpara>\r
162 <simpara>Note: Newer CVS versions (&gt;= 1.12.11) also support specifying\r
163 CVS_SERVER directly in CVSROOT like</simpara>\r
164 <screen>cvs -d ":ext;CVS_SERVER=git cvsserver:user@server/path/repo.git" co &lt;HEAD_name&gt;</screen>\r
165 <simpara>This has the advantage that it will be saved in your <emphasis>CVS/Root</emphasis> files and\r
166 you don't need to worry about always setting the correct environment\r
167 variable.  SSH users restricted to <emphasis>git-shell</emphasis> don't need to override the default\r
168 with CVS_SERVER (and shouldn't) as <emphasis>git-shell</emphasis> understands <emphasis>cvs</emphasis> to mean\r
169 <emphasis>git-cvsserver</emphasis> and pretends that the other end runs the real <emphasis>cvs</emphasis> better.</simpara>\r
170 </listitem>\r
171 <listitem>\r
172 <simpara>\r
173 For each repo that you want accessible from CVS you need to edit config in\r
174    the repo and add the following section.\r
175 </simpara>\r
176 <screen>   [gitcvs]\r
177         enabled=1\r
178         # optional for debugging\r
179         logfile=/path/to/logfile</screen>\r
180 <simpara>Note: you need to ensure each user that is going to invoke <emphasis>git-cvsserver</emphasis> has\r
181 write access to the log file and to the database (see\r
182 <link linkend="dbbackend">Database Backend</link>. If you want to offer write access over\r
183 SSH, the users of course also need write access to the git repository itself.</simpara>\r
184 <simpara>You also need to ensure that each repository is "bare" (without a git index\r
185 file) for <emphasis>cvs commit</emphasis> to work. See <xref linkend="gitcvs-migration(7)" />.</simpara>\r
186 <simpara id="configaccessmethod">All configuration variables can also be overridden for a specific method of\r
187 access. Valid method names are "ext" (for SSH access) and "pserver". The\r
188 following example configuration would disable pserver access while still\r
189 allowing access over SSH.</simpara>\r
190 <screen>   [gitcvs]\r
191         enabled=0\r
193    [gitcvs "ext"]\r
194         enabled=1</screen>\r
195 </listitem>\r
196 <listitem>\r
197 <simpara>\r
198 If you didn't specify the CVSROOT/CVS_SERVER directly in the checkout command,\r
199    automatically saving it in your <emphasis>CVS/Root</emphasis> files, then you need to set them\r
200    explicitly in your environment.  CVSROOT should be set as per normal, but the\r
201    directory should point at the appropriate git repo.  As above, for SSH clients\r
202    <emphasis>not</emphasis> restricted to <emphasis>git-shell</emphasis>, CVS_SERVER should be set to <emphasis>git-cvsserver</emphasis>.\r
203 </simpara>\r
204 <screen>     export CVSROOT=:ext:user@server:/var/git/project.git\r
205      export CVS_SERVER="git cvsserver"</screen>\r
206 </listitem>\r
207 <listitem>\r
208 <simpara>\r
209 For SSH clients that will make commits, make sure their server-side\r
210    .ssh/environment files (or .bashrc, etc., according to their specific shell)\r
211    export appropriate values for GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL,\r
212    GIT_COMMITTER_NAME, and GIT_COMMITTER_EMAIL.  For SSH clients whose login\r
213    shell is bash, .bashrc may be a reasonable alternative.\r
214 </simpara>\r
215 </listitem>\r
216 <listitem>\r
217 <simpara>\r
218 Clients should now be able to check out the project. Use the CVS <emphasis>module</emphasis>\r
219    name to indicate what GIT <emphasis>head</emphasis> you want to check out.  This also sets the\r
220    name of your newly checked-out directory, unless you tell it otherwise with\r
221    <emphasis>-d &lt;dir_name&gt;</emphasis>.  For example, this checks out <emphasis>master</emphasis> branch to the\r
222    <emphasis>project-master</emphasis> directory:\r
223 </simpara>\r
224 <screen>     cvs co -d project-master master</screen>\r
225 </listitem>\r
226 </orderedlist>\r
227 </simplesect>\r
228 <simplesect id="dbbackend">\r
229 <title>Database Backend</title>\r
230 <simpara><emphasis>git-cvsserver</emphasis> uses one database per git head (i.e. CVS module) to\r
231 store information about the repository to maintain consistent\r
232 CVS revision numbers. The database needs to be\r
233 updated (i.e. written to) after every commit.</simpara>\r
234 <simpara>If the commit is done directly by using <emphasis>git</emphasis> (as opposed to\r
235 using <emphasis>git-cvsserver</emphasis>) the update will need to happen on the\r
236 next repository access by <emphasis>git-cvsserver</emphasis>, independent of\r
237 access method and requested operation.</simpara>\r
238 <simpara>That means that even if you offer only read access (e.g. by using\r
239 the pserver method), <emphasis>git-cvsserver</emphasis> should have write access to\r
240 the database to work reliably (otherwise you need to make sure\r
241 that the database is up-to-date any time <emphasis>git-cvsserver</emphasis> is executed).</simpara>\r
242 <simpara>By default it uses SQLite databases in the git directory, named\r
243 <emphasis>gitcvs.&lt;module_name&gt;.sqlite</emphasis>. Note that the SQLite backend creates\r
244 temporary files in the same directory as the database file on\r
245 write so it might not be enough to grant the users using\r
246 <emphasis>git-cvsserver</emphasis> write access to the database file without granting\r
247 them write access to the directory, too.</simpara>\r
248 <simpara>The database can not be reliably regenerated in a\r
249 consistent form after the branch it is tracking has changed.\r
250 Example: For merged branches, <emphasis>git-cvsserver</emphasis> only tracks\r
251 one branch of development, and after a <emphasis>git merge</emphasis> an\r
252 incrementally updated database may track a different branch\r
253 than a database regenerated from scratch, causing inconsistent\r
254 CVS revision numbers. <emphasis>git-cvsserver</emphasis> has no way of knowing which\r
255 branch it would have picked if it had been run incrementally\r
256 pre-merge. So if you have to fully or partially (from old\r
257 backup) regenerate the database, you should be suspicious\r
258 of pre-existing CVS sandboxes.</simpara>\r
259 <simpara>You can configure the database backend with the following\r
260 configuration variables:</simpara>\r
261 <section id="_configuring_database_backend">\r
262 <title>Configuring database backend</title>\r
263 <simpara><emphasis>git-cvsserver</emphasis> uses the Perl DBI module. Please also read\r
264 its documentation if changing these variables, especially\r
265 about <emphasis>DBI-&gt;connect()</emphasis>.</simpara>\r
266 <variablelist>\r
267 <varlistentry>\r
268 <term>\r
269 gitcvs.dbname\r
270 </term>\r
271 <listitem>\r
272 <simpara>\r
273         Database name. The exact meaning depends on the\r
274         selected database driver, for SQLite this is a filename.\r
275         Supports variable substitution (see below). May\r
276         not contain semicolons (<emphasis>;</emphasis>).\r
277         Default: <emphasis>%Ggitcvs.%m.sqlite</emphasis>\r
278 </simpara>\r
279 </listitem>\r
280 </varlistentry>\r
281 <varlistentry>\r
282 <term>\r
283 gitcvs.dbdriver\r
284 </term>\r
285 <listitem>\r
286 <simpara>\r
287         Used DBI driver. You can specify any available driver\r
288         for this here, but it might not work. cvsserver is tested\r
289         with <emphasis>DBD::SQLite</emphasis>, reported to work with\r
290         <emphasis>DBD::Pg</emphasis>, and reported <emphasis role="strong">not</emphasis> to work with <emphasis>DBD::mysql</emphasis>.\r
291         Please regard this as an experimental feature. May not\r
292         contain colons (<emphasis>:</emphasis>).\r
293         Default: <emphasis>SQLite</emphasis>\r
294 </simpara>\r
295 </listitem>\r
296 </varlistentry>\r
297 <varlistentry>\r
298 <term>\r
299 gitcvs.dbuser\r
300 </term>\r
301 <listitem>\r
302 <simpara>\r
303         Database user. Only useful if setting <emphasis>dbdriver</emphasis>, since\r
304         SQLite has no concept of database users. Supports variable\r
305         substitution (see below).\r
306 </simpara>\r
307 </listitem>\r
308 </varlistentry>\r
309 <varlistentry>\r
310 <term>\r
311 gitcvs.dbpass\r
312 </term>\r
313 <listitem>\r
314 <simpara>\r
315         Database password.  Only useful if setting <emphasis>dbdriver</emphasis>, since\r
316         SQLite has no concept of database passwords.\r
317 </simpara>\r
318 </listitem>\r
319 </varlistentry>\r
320 <varlistentry>\r
321 <term>\r
322 gitcvs.dbTableNamePrefix\r
323 </term>\r
324 <listitem>\r
325 <simpara>\r
326         Database table name prefix.  Supports variable substitution\r
327         (see below).  Any non-alphabetic characters will be replaced\r
328         with underscores.\r
329 </simpara>\r
330 </listitem>\r
331 </varlistentry>\r
332 </variablelist>\r
333 <simpara>All variables can also be set per access method, see <link linkend="configaccessmethod">above</link>.</simpara>\r
334 <section id="_variable_substitution">\r
335 <title>Variable substitution</title>\r
336 <simpara>In <emphasis>dbdriver</emphasis> and <emphasis>dbuser</emphasis> you can use the following variables:</simpara>\r
337 <variablelist>\r
338 <varlistentry>\r
339 <term>\r
340 %G\r
341 </term>\r
342 <listitem>\r
343 <simpara>\r
344         git directory name\r
345 </simpara>\r
346 </listitem>\r
347 </varlistentry>\r
348 <varlistentry>\r
349 <term>\r
350 %g\r
351 </term>\r
352 <listitem>\r
353 <simpara>\r
354         git directory name, where all characters except for\r
355         alpha-numeric ones, <emphasis>.</emphasis>, and <emphasis>-</emphasis> are replaced with\r
356         <emphasis>_</emphasis> (this should make it easier to use the directory\r
357         name in a filename if wanted)\r
358 </simpara>\r
359 </listitem>\r
360 </varlistentry>\r
361 <varlistentry>\r
362 <term>\r
363 %m\r
364 </term>\r
365 <listitem>\r
366 <simpara>\r
367         CVS module/git head name\r
368 </simpara>\r
369 </listitem>\r
370 </varlistentry>\r
371 <varlistentry>\r
372 <term>\r
373 %a\r
374 </term>\r
375 <listitem>\r
376 <simpara>\r
377         access method (one of "ext" or "pserver")\r
378 </simpara>\r
379 </listitem>\r
380 </varlistentry>\r
381 <varlistentry>\r
382 <term>\r
383 %u\r
384 </term>\r
385 <listitem>\r
386 <simpara>\r
387         Name of the user running <emphasis>git-cvsserver</emphasis>.\r
388         If no name can be determined, the\r
389         numeric uid is used.\r
390 </simpara>\r
391 </listitem>\r
392 </varlistentry>\r
393 </variablelist>\r
394 </section>\r
395 </section>\r
396 </simplesect>\r
397 <simplesect id="_environment">\r
398 <title>ENVIRONMENT</title>\r
399 <simpara>These variables obviate the need for command-line options in some\r
400 circumstances, allowing easier restricted usage through git-shell.</simpara>\r
401 <simpara>GIT_CVSSERVER_BASE_PATH takes the place of the argument to --base-path.</simpara>\r
402 <simpara>GIT_CVSSERVER_ROOT specifies a single-directory whitelist. The\r
403 repository must still be configured to allow access through\r
404 git-cvsserver, as described above.</simpara>\r
405 <simpara>When these environment variables are set, the corresponding\r
406 command-line arguments may not be used.</simpara>\r
407 </simplesect>\r
408 <simplesect id="_eclipse_cvs_client_notes">\r
409 <title>Eclipse CVS Client Notes</title>\r
410 <simpara>To get a checkout with the Eclipse CVS client:</simpara>\r
411 <orderedlist numeration="arabic">\r
412 <listitem>\r
413 <simpara>\r
414 Select "Create a new project &#8594; From CVS checkout"\r
415 </simpara>\r
416 </listitem>\r
417 <listitem>\r
418 <simpara>\r
419 Create a new location. See the notes below for details on how to choose the\r
420    right protocol.\r
421 </simpara>\r
422 </listitem>\r
423 <listitem>\r
424 <simpara>\r
425 Browse the <emphasis>modules</emphasis> available. It will give you a list of the heads in\r
426    the repository. You will not be able to browse the tree from there. Only\r
427    the heads.\r
428 </simpara>\r
429 </listitem>\r
430 <listitem>\r
431 <simpara>\r
432 Pick <emphasis>HEAD</emphasis> when it asks what branch/tag to check out. Untick the\r
433    "launch commit wizard" to avoid committing the .project file.\r
434 </simpara>\r
435 </listitem>\r
436 </orderedlist>\r
437 <simpara>Protocol notes: If you are using anonymous access via pserver, just select that.\r
438 Those using SSH access should choose the <emphasis>ext</emphasis> protocol, and configure <emphasis>ext</emphasis>\r
439 access on the Preferences&#8594;Team&#8594;CVS&#8594;ExtConnection pane. Set CVS_SERVER to\r
440 "<emphasis>git cvsserver</emphasis>". Note that password support is not good when using <emphasis>ext</emphasis>,\r
441 you will definitely want to have SSH keys setup.</simpara>\r
442 <simpara>Alternatively, you can just use the non-standard extssh protocol that Eclipse\r
443 offer. In that case CVS_SERVER is ignored, and you will have to replace\r
444 the cvs utility on the server with <emphasis>git-cvsserver</emphasis> or manipulate your <emphasis>.bashrc</emphasis>\r
445 so that calling <emphasis>cvs</emphasis> effectively calls <emphasis>git-cvsserver</emphasis>.</simpara>\r
446 </simplesect>\r
447 <simplesect id="_clients_known_to_work">\r
448 <title>Clients known to work</title>\r
449 <itemizedlist>\r
450 <listitem>\r
451 <simpara>\r
452 CVS 1.12.9 on Debian\r
453 </simpara>\r
454 </listitem>\r
455 <listitem>\r
456 <simpara>\r
457 CVS 1.11.17 on MacOSX (from Fink package)\r
458 </simpara>\r
459 </listitem>\r
460 <listitem>\r
461 <simpara>\r
462 Eclipse 3.0, 3.1.2 on MacOSX (see Eclipse CVS Client Notes)\r
463 </simpara>\r
464 </listitem>\r
465 <listitem>\r
466 <simpara>\r
467 TortoiseCVS\r
468 </simpara>\r
469 </listitem>\r
470 </itemizedlist>\r
471 </simplesect>\r
472 <simplesect id="_operations_supported">\r
473 <title>Operations supported</title>\r
474 <simpara>All the operations required for normal use are supported, including\r
475 checkout, diff, status, update, log, add, remove, commit.\r
476 Legacy monitoring operations are not supported (edit, watch and related).\r
477 Exports and tagging (tags and branches) are not supported at this stage.</simpara>\r
478 <section id="_crlf_line_ending_conversions">\r
479 <title>CRLF Line Ending Conversions</title>\r
480 <simpara>By default the server leaves the <emphasis>-k</emphasis> mode blank for all files,\r
481 which causes the CVS client to treat them as a text files, subject\r
482 to end-of-line conversion on some platforms.</simpara>\r
483 <simpara>You can make the server use the end-of-line conversion attributes to\r
484 set the <emphasis>-k</emphasis> modes for files by setting the <emphasis>gitcvs.usecrlfattr</emphasis>\r
485 config variable.  See <xref linkend="gitattributes(5)" /> for more information\r
486 about end-of-line conversion.</simpara>\r
487 <simpara>Alternatively, if <emphasis>gitcvs.usecrlfattr</emphasis> config is not enabled\r
488 or the attributes do not allow automatic detection for a filename, then\r
489 the server uses the <emphasis>gitcvs.allbinary</emphasis> config for the default setting.\r
490 If <emphasis>gitcvs.allbinary</emphasis> is set, then file not otherwise\r
491 specified will default to <emphasis>-kb</emphasis> mode. Otherwise the <emphasis>-k</emphasis> mode\r
492 is left blank. But if <emphasis>gitcvs.allbinary</emphasis> is set to "guess", then\r
493 the correct <emphasis>-k</emphasis> mode will be guessed based on the contents of\r
494 the file.</simpara>\r
495 <simpara>For best consistency with <emphasis>cvs</emphasis>, it is probably best to override the\r
496 defaults by setting <emphasis>gitcvs.usecrlfattr</emphasis> to true,\r
497 and <emphasis>gitcvs.allbinary</emphasis> to "guess".</simpara>\r
498 </section>\r
499 </simplesect>\r
500 <simplesect id="_dependencies">\r
501 <title>Dependencies</title>\r
502 <simpara><emphasis>git-cvsserver</emphasis> depends on DBD::SQLite.</simpara>\r
503 </simplesect>\r
504 <simplesect id="_git">\r
505 <title>GIT</title>\r
506 <simpara>Part of the <xref linkend="git(1)" /> suite</simpara>\r
507 </simplesect>\r
508 </article>\r