OSDN Git Service

Add Git official document to help
[tortoisegit/TortoiseGitJp.git] / doc / source / en / TortoiseGit / git_doc / git-cvsserver.html.xml
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/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&#8217;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&#8217;t check for <literal>gitcvs.enabled</literal> 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 <literal>gitcvs.enabled</literal> 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>Currently cvsserver works over SSH connections for read/write clients, and\r
124 over pserver for anonymous CVS access.</simpara>\r
125 <simpara>CVS clients cannot tag, branch or perform GIT merges.</simpara>\r
126 <simpara><emphasis>git-cvsserver</emphasis> maps GIT branches to CVS modules. This is very different\r
127 from what most CVS users would expect since in CVS modules usually represent\r
128 one or more directories.</simpara>\r
129 </simplesect>\r
130 <simplesect id="_installation">\r
131 <title>INSTALLATION</title>\r
132 <orderedlist numeration="arabic">\r
133 <listitem>\r
134 <simpara>\r
135 If you are going to offer anonymous CVS access via pserver, add a line in\r
136    /etc/inetd.conf like\r
137 </simpara>\r
138 <literallayout>   cvspserver stream tcp nowait nobody git-cvsserver pserver</literallayout>\r
139 <simpara>Note: Some inetd servers let you specify the name of the executable\r
140 independently of the value of argv[0] (i.e. the name the program assumes\r
141 it was executed with). In this case the correct line in /etc/inetd.conf\r
142 looks like</simpara>\r
143 <literallayout>   cvspserver stream tcp nowait nobody /usr/bin/git-cvsserver git-cvsserver pserver</literallayout>\r
144 <simpara>No special setup is needed for SSH access, other than having GIT tools\r
145 in the PATH. If you have clients that do not accept the CVS_SERVER\r
146 environment variable, you can rename <emphasis>git-cvsserver</emphasis> to <literal>cvs</literal>.</simpara>\r
147 <simpara>Note: Newer CVS versions (&gt;= 1.12.11) also support specifying\r
148 CVS_SERVER directly in CVSROOT like</simpara>\r
149 <literallayout>cvs -d ":ext;CVS_SERVER=git cvsserver:user@server/path/repo.git" co &lt;HEAD_name&gt;</literallayout>\r
150 <simpara>This has the advantage that it will be saved in your <emphasis>CVS/Root</emphasis> files and\r
151 you don&#8217;t need to worry about always setting the correct environment\r
152 variable.  SSH users restricted to <emphasis>git-shell</emphasis> don&#8217;t need to override the default\r
153 with CVS_SERVER (and shouldn&#8217;t) as <emphasis>git-shell</emphasis> understands <literal>cvs</literal> to mean\r
154 <emphasis>git-cvsserver</emphasis> and pretends that the other end runs the real <emphasis>cvs</emphasis> better.</simpara>\r
155 </listitem>\r
156 <listitem>\r
157 <simpara>\r
158 For each repo that you want accessible from CVS you need to edit config in\r
159    the repo and add the following section.\r
160 </simpara>\r
161 <literallayout>   [gitcvs]\r
162         enabled=1\r
163         # optional for debugging\r
164         logfile=/path/to/logfile</literallayout>\r
165 <simpara>Note: you need to ensure each user that is going to invoke <emphasis>git-cvsserver</emphasis> has\r
166 write access to the log file and to the database (see\r
167 <link linkend="dbbackend">Database Backend</link>. If you want to offer write access over\r
168 SSH, the users of course also need write access to the git repository itself.</simpara>\r
169 <simpara>You also need to ensure that each repository is "bare" (without a git index\r
170 file) for <literal>cvs commit</literal> to work. See <xref linkend="gitcvs-migration(7)"/>.</simpara>\r
171 <simpara id="configaccessmethod">All configuration variables can also be overridden for a specific method of\r
172 access. Valid method names are "ext" (for SSH access) and "pserver". The\r
173 following example configuration would disable pserver access while still\r
174 allowing access over SSH.</simpara>\r
175 <literallayout>   [gitcvs]\r
176         enabled=0\r
177 \r
178    [gitcvs "ext"]\r
179         enabled=1</literallayout>\r
180 </listitem>\r
181 <listitem>\r
182 <simpara>\r
183 If you didn&#8217;t specify the CVSROOT/CVS_SERVER directly in the checkout command,\r
184    automatically saving it in your <emphasis>CVS/Root</emphasis> files, then you need to set them\r
185    explicitly in your environment.  CVSROOT should be set as per normal, but the\r
186    directory should point at the appropriate git repo.  As above, for SSH clients\r
187    <emphasis>not</emphasis> restricted to <emphasis>git-shell</emphasis>, CVS_SERVER should be set to <emphasis>git-cvsserver</emphasis>.\r
188 </simpara>\r
189 <literallayout>     export CVSROOT=:ext:user@server:/var/git/project.git\r
190      export CVS_SERVER="git cvsserver"</literallayout>\r
191 </listitem>\r
192 <listitem>\r
193 <simpara>\r
194 For SSH clients that will make commits, make sure their server-side\r
195    .ssh/environment files (or .bashrc, etc., according to their specific shell)\r
196    export appropriate values for GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL,\r
197    GIT_COMMITTER_NAME, and GIT_COMMITTER_EMAIL.  For SSH clients whose login\r
198    shell is bash, .bashrc may be a reasonable alternative.\r
199 </simpara>\r
200 </listitem>\r
201 <listitem>\r
202 <simpara>\r
203 Clients should now be able to check out the project. Use the CVS <emphasis>module</emphasis>\r
204    name to indicate what GIT <emphasis>head</emphasis> you want to check out.  This also sets the\r
205    name of your newly checked-out directory, unless you tell it otherwise with\r
206    <literal>-d &lt;dir_name&gt;</literal>.  For example, this checks out <emphasis>master</emphasis> branch to the\r
207    <literal>project-master</literal> directory:\r
208 </simpara>\r
209 <literallayout>     cvs co -d project-master master</literallayout>\r
210 </listitem>\r
211 </orderedlist>\r
212 </simplesect>\r
213 <simplesect id="dbbackend">\r
214 <title>Database Backend</title>\r
215 <simpara><emphasis>git-cvsserver</emphasis> uses one database per git head (i.e. CVS module) to\r
216 store information about the repository for faster access. The\r
217 database doesn&#8217;t contain any persistent data and can be completely\r
218 regenerated from the git repository at any time. The database\r
219 needs to be updated (i.e. written to) after every commit.</simpara>\r
220 <simpara>If the commit is done directly by using <literal>git</literal> (as opposed to\r
221 using <emphasis>git-cvsserver</emphasis>) the update will need to happen on the\r
222 next repository access by <emphasis>git-cvsserver</emphasis>, independent of\r
223 access method and requested operation.</simpara>\r
224 <simpara>That means that even if you offer only read access (e.g. by using\r
225 the pserver method), <emphasis>git-cvsserver</emphasis> should have write access to\r
226 the database to work reliably (otherwise you need to make sure\r
227 that the database is up-to-date any time <emphasis>git-cvsserver</emphasis> is executed).</simpara>\r
228 <simpara>By default it uses SQLite databases in the git directory, named\r
229 <literal>gitcvs.&lt;module_name&gt;.sqlite</literal>. Note that the SQLite backend creates\r
230 temporary files in the same directory as the database file on\r
231 write so it might not be enough to grant the users using\r
232 <emphasis>git-cvsserver</emphasis> write access to the database file without granting\r
233 them write access to the directory, too.</simpara>\r
234 <simpara>You can configure the database backend with the following\r
235 configuration variables:</simpara>\r
236 <simplesect id="_configuring_database_backend">\r
237 <title>Configuring database backend</title>\r
238 <simpara><emphasis>git-cvsserver</emphasis> uses the Perl DBI module. Please also read\r
239 its documentation if changing these variables, especially\r
240 about <literal>DBI&#8594;connect()</literal>.</simpara>\r
241 <variablelist>\r
242 <varlistentry>\r
243 <term>\r
244 gitcvs.dbname\r
245 </term>\r
246 <listitem>\r
247 <simpara>\r
248         Database name. The exact meaning depends on the\r
249         selected database driver, for SQLite this is a filename.\r
250         Supports variable substitution (see below). May\r
251         not contain semicolons (<literal>;</literal>).\r
252         Default: <emphasis>%Ggitcvs.%m.sqlite</emphasis>\r
253 </simpara>\r
254 </listitem>\r
255 </varlistentry>\r
256 <varlistentry>\r
257 <term>\r
258 gitcvs.dbdriver\r
259 </term>\r
260 <listitem>\r
261 <simpara>\r
262         Used DBI driver. You can specify any available driver\r
263         for this here, but it might not work. cvsserver is tested\r
264         with <emphasis>DBD::SQLite</emphasis>, reported to work with\r
265         <emphasis>DBD::Pg</emphasis>, and reported <emphasis role="strong">not</emphasis> to work with <emphasis>DBD::mysql</emphasis>.\r
266         Please regard this as an experimental feature. May not\r
267         contain colons (<literal>:</literal>).\r
268         Default: <emphasis>SQLite</emphasis>\r
269 </simpara>\r
270 </listitem>\r
271 </varlistentry>\r
272 <varlistentry>\r
273 <term>\r
274 gitcvs.dbuser\r
275 </term>\r
276 <listitem>\r
277 <simpara>\r
278         Database user. Only useful if setting <literal>dbdriver</literal>, since\r
279         SQLite has no concept of database users. Supports variable\r
280         substitution (see below).\r
281 </simpara>\r
282 </listitem>\r
283 </varlistentry>\r
284 <varlistentry>\r
285 <term>\r
286 gitcvs.dbpass\r
287 </term>\r
288 <listitem>\r
289 <simpara>\r
290         Database password.  Only useful if setting <literal>dbdriver</literal>, since\r
291         SQLite has no concept of database passwords.\r
292 </simpara>\r
293 </listitem>\r
294 </varlistentry>\r
295 <varlistentry>\r
296 <term>\r
297 gitcvs.dbTableNamePrefix\r
298 </term>\r
299 <listitem>\r
300 <simpara>\r
301         Database table name prefix.  Supports variable substitution\r
302         (see below).  Any non-alphabetic characters will be replaced\r
303         with underscores.\r
304 </simpara>\r
305 </listitem>\r
306 </varlistentry>\r
307 </variablelist>\r
308 <simpara>All variables can also be set per access method, see <link linkend="configaccessmethod">above</link>.</simpara>\r
309 <simplesect id="_variable_substitution">\r
310 <title>Variable substitution</title>\r
311 <simpara>In <literal>dbdriver</literal> and <literal>dbuser</literal> you can use the following variables:</simpara>\r
312 <variablelist>\r
313 <varlistentry>\r
314 <term>\r
315 %G\r
316 </term>\r
317 <listitem>\r
318 <simpara>\r
319         git directory name\r
320 </simpara>\r
321 </listitem>\r
322 </varlistentry>\r
323 <varlistentry>\r
324 <term>\r
325 %g\r
326 </term>\r
327 <listitem>\r
328 <simpara>\r
329         git directory name, where all characters except for\r
330         alpha-numeric ones, <literal>.</literal>, and <literal>-</literal> are replaced with\r
331         <literal>_</literal> (this should make it easier to use the directory\r
332         name in a filename if wanted)\r
333 </simpara>\r
334 </listitem>\r
335 </varlistentry>\r
336 <varlistentry>\r
337 <term>\r
338 %m\r
339 </term>\r
340 <listitem>\r
341 <simpara>\r
342         CVS module/git head name\r
343 </simpara>\r
344 </listitem>\r
345 </varlistentry>\r
346 <varlistentry>\r
347 <term>\r
348 %a\r
349 </term>\r
350 <listitem>\r
351 <simpara>\r
352         access method (one of "ext" or "pserver")\r
353 </simpara>\r
354 </listitem>\r
355 </varlistentry>\r
356 <varlistentry>\r
357 <term>\r
358 %u\r
359 </term>\r
360 <listitem>\r
361 <simpara>\r
362         Name of the user running <emphasis>git-cvsserver</emphasis>.\r
363         If no name can be determined, the\r
364         numeric uid is used.\r
365 </simpara>\r
366 </listitem>\r
367 </varlistentry>\r
368 </variablelist>\r
369 </simplesect>\r
370 </simplesect>\r
371 </simplesect>\r
372 <simplesect id="_eclipse_cvs_client_notes">\r
373 <title>Eclipse CVS Client Notes</title>\r
374 <simpara>To get a checkout with the Eclipse CVS client:</simpara>\r
375 <orderedlist numeration="arabic">\r
376 <listitem>\r
377 <simpara>\r
378 Select "Create a new project &#8594; From CVS checkout"\r
379 </simpara>\r
380 </listitem>\r
381 <listitem>\r
382 <simpara>\r
383 Create a new location. See the notes below for details on how to choose the\r
384    right protocol.\r
385 </simpara>\r
386 </listitem>\r
387 <listitem>\r
388 <simpara>\r
389 Browse the <emphasis>modules</emphasis> available. It will give you a list of the heads in\r
390    the repository. You will not be able to browse the tree from there. Only\r
391    the heads.\r
392 </simpara>\r
393 </listitem>\r
394 <listitem>\r
395 <simpara>\r
396 Pick <emphasis>HEAD</emphasis> when it asks what branch/tag to check out. Untick the\r
397    "launch commit wizard" to avoid committing the .project file.\r
398 </simpara>\r
399 </listitem>\r
400 </orderedlist>\r
401 <simpara>Protocol notes: If you are using anonymous access via pserver, just select that.\r
402 Those using SSH access should choose the <emphasis>ext</emphasis> protocol, and configure <emphasis>ext</emphasis>\r
403 access on the Preferences&#8594;Team&#8594;CVS&#8594;ExtConnection pane. Set CVS_SERVER to\r
404 "<emphasis>git cvsserver</emphasis>". Note that password support is not good when using <emphasis>ext</emphasis>,\r
405 you will definitely want to have SSH keys setup.</simpara>\r
406 <simpara>Alternatively, you can just use the non-standard extssh protocol that Eclipse\r
407 offer. In that case CVS_SERVER is ignored, and you will have to replace\r
408 the cvs utility on the server with <emphasis>git-cvsserver</emphasis> or manipulate your <literal>.bashrc</literal>\r
409 so that calling <emphasis>cvs</emphasis> effectively calls <emphasis>git-cvsserver</emphasis>.</simpara>\r
410 </simplesect>\r
411 <simplesect id="_clients_known_to_work">\r
412 <title>Clients known to work</title>\r
413 <itemizedlist>\r
414 <listitem>\r
415 <simpara>\r
416 CVS 1.12.9 on Debian\r
417 </simpara>\r
418 </listitem>\r
419 <listitem>\r
420 <simpara>\r
421 CVS 1.11.17 on MacOSX (from Fink package)\r
422 </simpara>\r
423 </listitem>\r
424 <listitem>\r
425 <simpara>\r
426 Eclipse 3.0, 3.1.2 on MacOSX (see Eclipse CVS Client Notes)\r
427 </simpara>\r
428 </listitem>\r
429 <listitem>\r
430 <simpara>\r
431 TortoiseCVS\r
432 </simpara>\r
433 </listitem>\r
434 </itemizedlist>\r
435 </simplesect>\r
436 <simplesect id="_operations_supported">\r
437 <title>Operations supported</title>\r
438 <simpara>All the operations required for normal use are supported, including\r
439 checkout, diff, status, update, log, add, remove, commit.\r
440 Legacy monitoring operations are not supported (edit, watch and related).\r
441 Exports and tagging (tags and branches) are not supported at this stage.</simpara>\r
442 <simplesect id="_crlf_line_ending_conversions">\r
443 <title>CRLF Line Ending Conversions</title>\r
444 <simpara>By default the server leaves the <emphasis>-k</emphasis> mode blank for all files,\r
445 which causes the cvs client to treat them as a text files, subject\r
446 to crlf conversion on some platforms.</simpara>\r
447 <simpara>You can make the server use <literal>crlf</literal> attributes to set the <emphasis>-k</emphasis> modes\r
448 for files by setting the <literal>gitcvs.usecrlfattr</literal> config variable.\r
449 In this case, if <literal>crlf</literal> is explicitly unset (<emphasis>-crlf</emphasis>), then the\r
450 server will set <emphasis>-kb</emphasis> mode for binary files. If <literal>crlf</literal> is set,\r
451 then the <emphasis>-k</emphasis> mode will explicitly be left blank.  See\r
452 also <xref linkend="gitattributes(5)"/> for more information about the <literal>crlf</literal>\r
453 attribute.</simpara>\r
454 <simpara>Alternatively, if <literal>gitcvs.usecrlfattr</literal> config is not enabled\r
455 or if the <literal>crlf</literal> attribute is unspecified for a filename, then\r
456 the server uses the <literal>gitcvs.allbinary</literal> config for the default setting.\r
457 If <literal>gitcvs.allbinary</literal> is set, then file not otherwise\r
458 specified will default to <emphasis>-kb</emphasis> mode. Otherwise the <emphasis>-k</emphasis> mode\r
459 is left blank. But if <literal>gitcvs.allbinary</literal> is set to "guess", then\r
460 the correct <emphasis>-k</emphasis> mode will be guessed based on the contents of\r
461 the file.</simpara>\r
462 <simpara>For best consistency with <emphasis>cvs</emphasis>, it is probably best to override the\r
463 defaults by setting <literal>gitcvs.usecrlfattr</literal> to true,\r
464 and <literal>gitcvs.allbinary</literal> to "guess".</simpara>\r
465 </simplesect>\r
466 </simplesect>\r
467 <simplesect id="_dependencies">\r
468 <title>Dependencies</title>\r
469 <simpara><emphasis>git-cvsserver</emphasis> depends on DBD::SQLite.</simpara>\r
470 </simplesect>\r
471 <simplesect id="_copyright_and_authors">\r
472 <title>Copyright and Authors</title>\r
473 <simpara>This program is copyright The Open University UK - 2006.</simpara>\r
474 <simpara>Authors:</simpara>\r
475 <itemizedlist>\r
476 <listitem>\r
477 <simpara>\r
478 Martyn Smith    &lt;<ulink url="mailto:martyn@catalyst.net.nz">martyn@catalyst.net.nz</ulink>&gt;\r
479 </simpara>\r
480 </listitem>\r
481 <listitem>\r
482 <simpara>\r
483 Martin Langhoff &lt;<ulink url="mailto:martin@catalyst.net.nz">martin@catalyst.net.nz</ulink>&gt;\r
484 </simpara>\r
485 </listitem>\r
486 </itemizedlist>\r
487 <simpara>with ideas and patches from participants of the git-list &lt;<ulink url="mailto:git@vger.kernel.org">git@vger.kernel.org</ulink>&gt;.</simpara>\r
488 </simplesect>\r
489 <simplesect id="_documentation">\r
490 <title>Documentation</title>\r
491 <simpara>Documentation by Martyn Smith &lt;<ulink url="mailto:martyn@catalyst.net.nz">martyn@catalyst.net.nz</ulink>&gt;, Martin Langhoff &lt;<ulink url="mailto:martin@catalyst.net.nz">martin@catalyst.net.nz</ulink>&gt;, and Matthias Urlichs &lt;<ulink url="mailto:smurf@smurf.noris.de">smurf@smurf.noris.de</ulink>&gt;.</simpara>\r
492 </simplesect>\r
493 <simplesect id="_git">\r
494 <title>GIT</title>\r
495 <simpara>Part of the <xref linkend="git(1)"/> suite</simpara>\r
496 </simplesect>\r
497 </article>\r