1GIT-CVSSERVER(1) Git Manual GIT-CVSSERVER(1)
2
3
4
6 git-cvsserver - A CVS server emulator for Git
7
9 SSH:
10
11 export CVS_SERVER="git cvsserver"
12 cvs -d :ext:user@server/path/repo.git co <HEAD_name>
13
14
15 pserver (/etc/inetd.conf):
16
17 cvspserver stream tcp nowait nobody /usr/bin/git-cvsserver git-cvsserver pserver
18
19
20 Usage:
21
22 git-cvsserver [options] [pserver|server] [<directory> ...]
23
24
26 All these options obviously only make sense if enforced by the server
27 side. They have been implemented to resemble the git-daemon(1) options
28 as closely as possible.
29
30 --base-path <path>
31 Prepend path to requested CVSROOT
32
33 --strict-paths
34 Don’t allow recursing into subdirectories
35
36 --export-all
37 Don’t check for gitcvs.enabled in config. You also have to specify
38 a list of allowed directories (see below) if you want to use this
39 option.
40
41 -V, --version
42 Print version information and exit
43
44 -h, -H, --help
45 Print usage information and exit
46
47 <directory>
48 You can specify a list of allowed directories. If no directories
49 are given, all are allowed. This is an additional restriction,
50 gitcvs access still needs to be enabled by the gitcvs.enabled
51 config option unless --export-all was given, too.
52
54 This application is a CVS emulation layer for Git.
55
56 It is highly functional. However, not all methods are implemented, and
57 for those methods that are implemented, not all switches are
58 implemented.
59
60 Testing has been done using both the CLI CVS client, and the Eclipse
61 CVS plugin. Most functionality works fine with both of these clients.
62
64 CVS clients cannot tag, branch or perform Git merges.
65
66 git-cvsserver maps Git branches to CVS modules. This is very different
67 from what most CVS users would expect since in CVS modules usually
68 represent one or more directories.
69
71 1. If you are going to offer CVS access via pserver, add a line in
72 /etc/inetd.conf like
73
74 cvspserver stream tcp nowait nobody git-cvsserver pserver
75
76 Note: Some inetd servers let you specify the name of the executable
77 independently of the value of argv[0] (i.e. the name the program
78 assumes it was executed with). In this case the correct line in
79 /etc/inetd.conf looks like
80
81 cvspserver stream tcp nowait nobody /usr/bin/git-cvsserver git-cvsserver pserver
82
83 Only anonymous access is provided by pserve by default. To commit
84 you will have to create pserver accounts, simply add a
85 gitcvs.authdb setting in the config file of the repositories you
86 want the cvsserver to allow writes to, for example:
87
88 [gitcvs]
89 authdb = /etc/cvsserver/passwd
90
91 The format of these files is username followed by the crypted
92 password, for example:
93
94 myuser:$1Oyx5r9mdGZ2
95 myuser:$1$BA)@$vbnMJMDym7tA32AamXrm./
96
97 You can use the htpasswd facility that comes with Apache to make
98 these files, but Apache’s MD5 crypt method differs from the one
99 used by most C library’s crypt() function, so don’t use the -m
100 option.
101
102 Alternatively you can produce the password with perl’s crypt()
103 operator:
104
105 perl -e 'my ($user, $pass) = @ARGV; printf "%s:%s\n", $user, crypt($user, $pass)' $USER password
106
107 Then provide your password via the pserver method, for example:
108
109 cvs -d:pserver:someuser:somepassword <at> server/path/repo.git co <HEAD_name>
110
111 No special setup is needed for SSH access, other than having Git
112 tools in the PATH. If you have clients that do not accept the
113 CVS_SERVER environment variable, you can rename git-cvsserver to
114 cvs.
115
116 Note: Newer CVS versions (>= 1.12.11) also support specifying
117 CVS_SERVER directly in CVSROOT like
118
119 cvs -d ":ext;CVS_SERVER=git cvsserver:user@server/path/repo.git" co <HEAD_name>
120
121 This has the advantage that it will be saved in your CVS/Root files
122 and you don’t need to worry about always setting the correct
123 environment variable. SSH users restricted to git-shell don’t need
124 to override the default with CVS_SERVER (and shouldn’t) as
125 git-shell understands cvs to mean git-cvsserver and pretends that
126 the other end runs the real cvs better.
127
128 2. For each repo that you want accessible from CVS you need to edit
129 config in the repo and add the following section.
130
131 [gitcvs]
132 enabled=1
133 # optional for debugging
134 logfile=/path/to/logfile
135
136 Note: you need to ensure each user that is going to invoke
137 git-cvsserver has write access to the log file and to the database
138 (see Database Backend. If you want to offer write access over SSH,
139 the users of course also need write access to the Git repository
140 itself.
141
142 You also need to ensure that each repository is "bare" (without a
143 Git index file) for cvs commit to work. See gitcvs-migration(7).
144
145 All configuration variables can also be overridden for a specific
146 method of access. Valid method names are "ext" (for SSH access) and
147 "pserver". The following example configuration would disable
148 pserver access while still allowing access over SSH.
149
150 [gitcvs]
151 enabled=0
152
153 [gitcvs "ext"]
154 enabled=1
155
156
157 3. If you didn’t specify the CVSROOT/CVS_SERVER directly in the
158 checkout command, automatically saving it in your CVS/Root files,
159 then you need to set them explicitly in your environment. CVSROOT
160 should be set as per normal, but the directory should point at the
161 appropriate Git repo. As above, for SSH clients not restricted to
162 git-shell, CVS_SERVER should be set to git-cvsserver.
163
164 export CVSROOT=:ext:user@server:/var/git/project.git
165 export CVS_SERVER="git cvsserver"
166
167
168 4. For SSH clients that will make commits, make sure their server-side
169 .ssh/environment files (or .bashrc, etc., according to their
170 specific shell) export appropriate values for GIT_AUTHOR_NAME,
171 GIT_AUTHOR_EMAIL, GIT_COMMITTER_NAME, and GIT_COMMITTER_EMAIL. For
172 SSH clients whose login shell is bash, .bashrc may be a reasonable
173 alternative.
174
175 5. Clients should now be able to check out the project. Use the CVS
176 module name to indicate what Git head you want to check out. This
177 also sets the name of your newly checked-out directory, unless you
178 tell it otherwise with -d <dir_name>. For example, this checks out
179 master branch to the project-master directory:
180
181 cvs co -d project-master master
182
183
185 git-cvsserver uses one database per Git head (i.e. CVS module) to store
186 information about the repository to maintain consistent CVS revision
187 numbers. The database needs to be updated (i.e. written to) after every
188 commit.
189
190 If the commit is done directly by using git (as opposed to using
191 git-cvsserver) the update will need to happen on the next repository
192 access by git-cvsserver, independent of access method and requested
193 operation.
194
195 That means that even if you offer only read access (e.g. by using the
196 pserver method), git-cvsserver should have write access to the database
197 to work reliably (otherwise you need to make sure that the database is
198 up-to-date any time git-cvsserver is executed).
199
200 By default it uses SQLite databases in the Git directory, named
201 gitcvs.<module_name>.sqlite. Note that the SQLite backend creates
202 temporary files in the same directory as the database file on write so
203 it might not be enough to grant the users using git-cvsserver write
204 access to the database file without granting them write access to the
205 directory, too.
206
207 The database can not be reliably regenerated in a consistent form after
208 the branch it is tracking has changed. Example: For merged branches,
209 git-cvsserver only tracks one branch of development, and after a git
210 merge an incrementally updated database may track a different branch
211 than a database regenerated from scratch, causing inconsistent CVS
212 revision numbers. git-cvsserver has no way of knowing which branch it
213 would have picked if it had been run incrementally pre-merge. So if you
214 have to fully or partially (from old backup) regenerate the database,
215 you should be suspicious of pre-existing CVS sandboxes.
216
217 You can configure the database backend with the following configuration
218 variables:
219
220 Configuring database backend
221 git-cvsserver uses the Perl DBI module. Please also read its
222 documentation if changing these variables, especially about
223 DBI->connect().
224
225 gitcvs.dbname
226 Database name. The exact meaning depends on the selected database
227 driver, for SQLite this is a filename. Supports variable
228 substitution (see below). May not contain semicolons (;). Default:
229 %Ggitcvs.%m.sqlite
230
231 gitcvs.dbdriver
232 Used DBI driver. You can specify any available driver for this
233 here, but it might not work. cvsserver is tested with DBD::SQLite,
234 reported to work with DBD::Pg, and reported not to work with
235 DBD::mysql. Please regard this as an experimental feature. May not
236 contain colons (:). Default: SQLite
237
238 gitcvs.dbuser
239 Database user. Only useful if setting dbdriver, since SQLite has no
240 concept of database users. Supports variable substitution (see
241 below).
242
243 gitcvs.dbpass
244 Database password. Only useful if setting dbdriver, since SQLite
245 has no concept of database passwords.
246
247 gitcvs.dbTableNamePrefix
248 Database table name prefix. Supports variable substitution (see
249 below). Any non-alphabetic characters will be replaced with
250 underscores.
251
252 All variables can also be set per access method, see above.
253
254 Variable substitution
255 In dbdriver and dbuser you can use the following variables:
256
257 %G
258 Git directory name
259
260 %g
261 Git directory name, where all characters except for
262 alpha-numeric ones, ., and - are replaced with _ (this should
263 make it easier to use the directory name in a filename if
264 wanted)
265
266 %m
267 CVS module/Git head name
268
269 %a
270 access method (one of "ext" or "pserver")
271
272 %u
273 Name of the user running git-cvsserver. If no name can be
274 determined, the numeric uid is used.
275
277 These variables obviate the need for command-line options in some
278 circumstances, allowing easier restricted usage through git-shell.
279
280 GIT_CVSSERVER_BASE_PATH takes the place of the argument to --base-path.
281
282 GIT_CVSSERVER_ROOT specifies a single-directory whitelist. The
283 repository must still be configured to allow access through
284 git-cvsserver, as described above.
285
286 When these environment variables are set, the corresponding
287 command-line arguments may not be used.
288
290 To get a checkout with the Eclipse CVS client:
291
292 1. Select "Create a new project → From CVS checkout"
293
294 2. Create a new location. See the notes below for details on how to
295 choose the right protocol.
296
297 3. Browse the modules available. It will give you a list of the heads
298 in the repository. You will not be able to browse the tree from
299 there. Only the heads.
300
301 4. Pick HEAD when it asks what branch/tag to check out. Untick the
302 "launch commit wizard" to avoid committing the .project file.
303
304 Protocol notes: If you are using anonymous access via pserver, just
305 select that. Those using SSH access should choose the ext protocol, and
306 configure ext access on the Preferences→Team→CVS→ExtConnection pane.
307 Set CVS_SERVER to "git cvsserver". Note that password support is not
308 good when using ext, you will definitely want to have SSH keys setup.
309
310 Alternatively, you can just use the non-standard extssh protocol that
311 Eclipse offer. In that case CVS_SERVER is ignored, and you will have to
312 replace the cvs utility on the server with git-cvsserver or manipulate
313 your .bashrc so that calling cvs effectively calls git-cvsserver.
314
316 · CVS 1.12.9 on Debian
317
318 · CVS 1.11.17 on MacOSX (from Fink package)
319
320 · Eclipse 3.0, 3.1.2 on MacOSX (see Eclipse CVS Client Notes)
321
322 · TortoiseCVS
323
325 All the operations required for normal use are supported, including
326 checkout, diff, status, update, log, add, remove, commit.
327
328 Most CVS command arguments that read CVS tags or revision numbers
329 (typically -r) work, and also support any git refspec (tag, branch,
330 commit ID, etc). However, CVS revision numbers for non-default branches
331 are not well emulated, and cvs log does not show tags or branches at
332 all. (Non-main-branch CVS revision numbers superficially resemble CVS
333 revision numbers, but they actually encode a git commit ID directly,
334 rather than represent the number of revisions since the branch point.)
335
336 Note that there are two ways to checkout a particular branch. As
337 described elsewhere on this page, the "module" parameter of cvs
338 checkout is interpreted as a branch name, and it becomes the main
339 branch. It remains the main branch for a given sandbox even if you
340 temporarily make another branch sticky with cvs update -r.
341 Alternatively, the -r argument can indicate some other branch to
342 actually checkout, even though the module is still the "main" branch.
343 Tradeoffs (as currently implemented): Each new "module" creates a new
344 database on disk with a history for the given module, and after the
345 database is created, operations against that main branch are fast. Or
346 alternatively, -r doesn’t take any extra disk space, but may be
347 significantly slower for many operations, like cvs update.
348
349 If you want to refer to a git refspec that has characters that are not
350 allowed by CVS, you have two options. First, it may just work to supply
351 the git refspec directly to the appropriate CVS -r argument; some CVS
352 clients don’t seem to do much sanity checking of the argument. Second,
353 if that fails, you can use a special character escape mechanism that
354 only uses characters that are valid in CVS tags. A sequence of 4 or 5
355 characters of the form (underscore ("_"), dash ("-"), one or two
356 characters, and dash ("-")) can encode various characters based on the
357 one or two letters: "s" for slash ("/"), "p" for period ("."), "u" for
358 underscore ("_"), or two hexadecimal digits for any byte value at all
359 (typically an ASCII number, or perhaps a part of a UTF-8 encoded
360 character).
361
362 Legacy monitoring operations are not supported (edit, watch and
363 related). Exports and tagging (tags and branches) are not supported at
364 this stage.
365
366 CRLF Line Ending Conversions
367 By default the server leaves the -k mode blank for all files, which
368 causes the CVS client to treat them as a text files, subject to
369 end-of-line conversion on some platforms.
370
371 You can make the server use the end-of-line conversion attributes to
372 set the -k modes for files by setting the gitcvs.usecrlfattr config
373 variable. See gitattributes(5) for more information about end-of-line
374 conversion.
375
376 Alternatively, if gitcvs.usecrlfattr config is not enabled or the
377 attributes do not allow automatic detection for a filename, then the
378 server uses the gitcvs.allbinary config for the default setting. If
379 gitcvs.allbinary is set, then file not otherwise specified will default
380 to -kb mode. Otherwise the -k mode is left blank. But if
381 gitcvs.allbinary is set to "guess", then the correct -k mode will be
382 guessed based on the contents of the file.
383
384 For best consistency with cvs, it is probably best to override the
385 defaults by setting gitcvs.usecrlfattr to true, and gitcvs.allbinary to
386 "guess".
387
389 git-cvsserver depends on DBD::SQLite.
390
392 Part of the git(1) suite
393
394
395
396Git 1.8.3.1 11/19/2018 GIT-CVSSERVER(1)