1GIT-CVSSERVER(1)                  Git Manual                  GIT-CVSSERVER(1)
2
3
4

NAME

6       git-cvsserver - A CVS server emulator for Git
7

SYNOPSIS

9       SSH:
10
11       export CVS_SERVER="git cvsserver"
12       cvs -d :ext:user@server/path/repo.git co <HEAD_name>
13
14       pserver (/etc/inetd.conf):
15
16       cvspserver stream tcp nowait nobody /usr/bin/git-cvsserver git-cvsserver pserver
17
18       Usage:
19
20       git-cvsserver [<options>] [pserver|server] [<directory> ...]
21

DESCRIPTION

23       This application is a CVS emulation layer for Git.
24
25       It is highly functional. However, not all methods are implemented, and
26       for those methods that are implemented, not all switches are
27       implemented.
28
29       Testing has been done using both the CLI CVS client, and the Eclipse
30       CVS plugin. Most functionality works fine with both of these clients.
31

OPTIONS

33       All these options obviously only make sense if enforced by the server
34       side. They have been implemented to resemble the git-daemon(1) options
35       as closely as possible.
36
37       --base-path <path>
38           Prepend path to requested CVSROOT
39
40       --strict-paths
41           Don’t allow recursing into subdirectories
42
43       --export-all
44           Don’t check for gitcvs.enabled in config. You also have to specify
45           a list of allowed directories (see below) if you want to use this
46           option.
47
48       -V, --version
49           Print version information and exit
50
51       -h, -H, --help
52           Print usage information and exit
53
54       <directory>
55           You can specify a list of allowed directories. If no directories
56           are given, all are allowed. This is an additional restriction,
57           gitcvs access still needs to be enabled by the gitcvs.enabled
58           config option unless --export-all was given, too.
59

LIMITATIONS

61       CVS clients cannot tag, branch or perform Git merges.
62
63       git-cvsserver maps Git branches to CVS modules. This is very different
64       from what most CVS users would expect since in CVS modules usually
65       represent one or more directories.
66

INSTALLATION

68        1. If you are going to offer CVS access via pserver, add a line in
69           /etc/inetd.conf like
70
71                  cvspserver stream tcp nowait nobody git-cvsserver pserver
72
73           Note: Some inetd servers let you specify the name of the executable
74           independently of the value of argv[0] (i.e. the name the program
75           assumes it was executed with). In this case the correct line in
76           /etc/inetd.conf looks like
77
78                  cvspserver stream tcp nowait nobody /usr/bin/git-cvsserver git-cvsserver pserver
79
80           Only anonymous access is provided by pserver by default. To commit
81           you will have to create pserver accounts, simply add a
82           gitcvs.authdb setting in the config file of the repositories you
83           want the cvsserver to allow writes to, for example:
84
85                  [gitcvs]
86                       authdb = /etc/cvsserver/passwd
87
88           The format of these files is username followed by the encrypted
89           password, for example:
90
91                  myuser:sqkNi8zPf01HI
92                  myuser:$1$9K7FzU28$VfF6EoPYCJEYcVQwATgOP/
93                  myuser:$5$.NqmNH1vwfzGpV8B$znZIcumu1tNLATgV2l6e1/mY8RzhUDHMOaVOeL1cxV3
94
95           You can use the htpasswd facility that comes with Apache to make
96           these files, but only with the -d option (or -B if your system
97           suports it).
98
99           Preferably use the system specific utility that manages password
100           hash creation in your platform (e.g. mkpasswd in Linux, encrypt in
101           OpenBSD or pwhash in NetBSD) and paste it in the right location.
102
103           Then provide your password via the pserver method, for example:
104
105                  cvs -d:pserver:someuser:somepassword@server:/path/repo.git co <HEAD_name>
106
107           No special setup is needed for SSH access, other than having Git
108           tools in the PATH. If you have clients that do not accept the
109           CVS_SERVER environment variable, you can rename git-cvsserver to
110           cvs.
111
112           Note: Newer CVS versions (>= 1.12.11) also support specifying
113           CVS_SERVER directly in CVSROOT like
114
115                  cvs -d ":ext;CVS_SERVER=git cvsserver:user@server/path/repo.git" co <HEAD_name>
116
117           This has the advantage that it will be saved in your CVS/Root files
118           and you don’t need to worry about always setting the correct
119           environment variable. SSH users restricted to git-shell don’t need
120           to override the default with CVS_SERVER (and shouldn’t) as
121           git-shell understands cvs to mean git-cvsserver and pretends that
122           the other end runs the real cvs better.
123
124        2. For each repo that you want accessible from CVS you need to edit
125           config in the repo and add the following section.
126
127                  [gitcvs]
128                       enabled=1
129                       # optional for debugging
130                       logFile=/path/to/logfile
131
132           Note: you need to ensure each user that is going to invoke
133           git-cvsserver has write access to the log file and to the database
134           (see Database Backend. If you want to offer write access over SSH,
135           the users of course also need write access to the Git repository
136           itself.
137
138           You also need to ensure that each repository is "bare" (without a
139           Git index file) for cvs commit to work. See gitcvs-migration(7).
140
141           All configuration variables can also be overridden for a specific
142           method of access. Valid method names are "ext" (for SSH access) and
143           "pserver". The following example configuration would disable
144           pserver access while still allowing access over SSH.
145
146                  [gitcvs]
147                       enabled=0
148
149                  [gitcvs "ext"]
150                       enabled=1
151
152        3. If you didn’t specify the CVSROOT/CVS_SERVER directly in the
153           checkout command, automatically saving it in your CVS/Root files,
154           then you need to set them explicitly in your environment. CVSROOT
155           should be set as per normal, but the directory should point at the
156           appropriate Git repo. As above, for SSH clients not restricted to
157           git-shell, CVS_SERVER should be set to git-cvsserver.
158
159                  export CVSROOT=:ext:user@server:/var/git/project.git
160                  export CVS_SERVER="git cvsserver"
161
162        4. For SSH clients that will make commits, make sure their server-side
163           .ssh/environment files (or .bashrc, etc., according to their
164           specific shell) export appropriate values for GIT_AUTHOR_NAME,
165           GIT_AUTHOR_EMAIL, GIT_COMMITTER_NAME, and GIT_COMMITTER_EMAIL. For
166           SSH clients whose login shell is bash, .bashrc may be a reasonable
167           alternative.
168
169        5. Clients should now be able to check out the project. Use the CVS
170           module name to indicate what Git head you want to check out. This
171           also sets the name of your newly checked-out directory, unless you
172           tell it otherwise with -d <dir_name>. For example, this checks out
173           master branch to the project-master directory:
174
175                  cvs co -d project-master master
176

DATABASE BACKEND

178       git-cvsserver uses one database per Git head (i.e. CVS module) to store
179       information about the repository to maintain consistent CVS revision
180       numbers. The database needs to be updated (i.e. written to) after every
181       commit.
182
183       If the commit is done directly by using git (as opposed to using
184       git-cvsserver) the update will need to happen on the next repository
185       access by git-cvsserver, independent of access method and requested
186       operation.
187
188       That means that even if you offer only read access (e.g. by using the
189       pserver method), git-cvsserver should have write access to the database
190       to work reliably (otherwise you need to make sure that the database is
191       up to date any time git-cvsserver is executed).
192
193       By default it uses SQLite databases in the Git directory, named
194       gitcvs.<module_name>.sqlite. Note that the SQLite backend creates
195       temporary files in the same directory as the database file on write so
196       it might not be enough to grant the users using git-cvsserver write
197       access to the database file without granting them write access to the
198       directory, too.
199
200       The database cannot be reliably regenerated in a consistent form after
201       the branch it is tracking has changed. Example: For merged branches,
202       git-cvsserver only tracks one branch of development, and after a git
203       merge an incrementally updated database may track a different branch
204       than a database regenerated from scratch, causing inconsistent CVS
205       revision numbers. git-cvsserver has no way of knowing which branch it
206       would have picked if it had been run incrementally pre-merge. So if you
207       have to fully or partially (from old backup) regenerate the database,
208       you should be suspicious of pre-existing CVS sandboxes.
209
210       You can configure the database backend with the following configuration
211       variables:
212
213   Configuring database backend
214       git-cvsserver uses the Perl DBI module. Please also read its
215       documentation if changing these variables, especially about
216       DBI->connect().
217
218       gitcvs.dbName
219           Database name. The exact meaning depends on the selected database
220           driver, for SQLite this is a filename. Supports variable
221           substitution (see below). May not contain semicolons (;). Default:
222           %Ggitcvs.%m.sqlite
223
224       gitcvs.dbDriver
225           Used DBI driver. You can specify any available driver for this
226           here, but it might not work. cvsserver is tested with DBD::SQLite,
227           reported to work with DBD::Pg, and reported not to work with
228           DBD::mysql. Please regard this as an experimental feature. May not
229           contain colons (:). Default: SQLite
230
231       gitcvs.dbuser
232           Database user. Only useful if setting dbDriver, since SQLite has no
233           concept of database users. Supports variable substitution (see
234           below).
235
236       gitcvs.dbPass
237           Database password. Only useful if setting dbDriver, since SQLite
238           has no concept of database passwords.
239
240       gitcvs.dbTableNamePrefix
241           Database table name prefix. Supports variable substitution (see
242           below). Any non-alphabetic characters will be replaced with
243           underscores.
244
245       All variables can also be set per access method, see above.
246
247       Variable substitution
248           In dbDriver and dbUser you can use the following variables:
249
250           %G
251               Git directory name
252
253           %g
254               Git directory name, where all characters except for
255               alphanumeric ones, ., and - are replaced with _ (this should
256               make it easier to use the directory name in a filename if
257               wanted)
258
259           %m
260               CVS module/Git head name
261
262           %a
263               access method (one of "ext" or "pserver")
264
265           %u
266               Name of the user running git-cvsserver. If no name can be
267               determined, the numeric uid is used.
268

ENVIRONMENT

270       These variables obviate the need for command-line options in some
271       circumstances, allowing easier restricted usage through git-shell.
272
273       GIT_CVSSERVER_BASE_PATH takes the place of the argument to --base-path.
274
275       GIT_CVSSERVER_ROOT specifies a single-directory whitelist. The
276       repository must still be configured to allow access through
277       git-cvsserver, as described above.
278
279       When these environment variables are set, the corresponding
280       command-line arguments may not be used.
281

ECLIPSE CVS CLIENT NOTES

283       To get a checkout with the Eclipse CVS client:
284
285        1. Select "Create a new project → From CVS checkout"
286
287        2. Create a new location. See the notes below for details on how to
288           choose the right protocol.
289
290        3. Browse the modules available. It will give you a list of the heads
291           in the repository. You will not be able to browse the tree from
292           there. Only the heads.
293
294        4. Pick HEAD when it asks what branch/tag to check out. Untick the
295           "launch commit wizard" to avoid committing the .project file.
296
297       Protocol notes: If you are using anonymous access via pserver, just
298       select that. Those using SSH access should choose the ext protocol, and
299       configure ext access on the Preferences→Team→CVS→ExtConnection pane.
300       Set CVS_SERVER to "git cvsserver". Note that password support is not
301       good when using ext, you will definitely want to have SSH keys setup.
302
303       Alternatively, you can just use the non-standard extssh protocol that
304       Eclipse offer. In that case CVS_SERVER is ignored, and you will have to
305       replace the cvs utility on the server with git-cvsserver or manipulate
306       your .bashrc so that calling cvs effectively calls git-cvsserver.
307

CLIENTS KNOWN TO WORK

309       •   CVS 1.12.9 on Debian
310
311       •   CVS 1.11.17 on MacOSX (from Fink package)
312
313       •   Eclipse 3.0, 3.1.2 on MacOSX (see Eclipse CVS Client Notes)
314
315       •   TortoiseCVS
316

OPERATIONS SUPPORTED

318       All the operations required for normal use are supported, including
319       checkout, diff, status, update, log, add, remove, commit.
320
321       Most CVS command arguments that read CVS tags or revision numbers
322       (typically -r) work, and also support any git refspec (tag, branch,
323       commit ID, etc). However, CVS revision numbers for non-default branches
324       are not well emulated, and cvs log does not show tags or branches at
325       all. (Non-main-branch CVS revision numbers superficially resemble CVS
326       revision numbers, but they actually encode a git commit ID directly,
327       rather than represent the number of revisions since the branch point.)
328
329       Note that there are two ways to checkout a particular branch. As
330       described elsewhere on this page, the "module" parameter of cvs
331       checkout is interpreted as a branch name, and it becomes the main
332       branch. It remains the main branch for a given sandbox even if you
333       temporarily make another branch sticky with cvs update -r.
334       Alternatively, the -r argument can indicate some other branch to
335       actually checkout, even though the module is still the "main" branch.
336       Tradeoffs (as currently implemented): Each new "module" creates a new
337       database on disk with a history for the given module, and after the
338       database is created, operations against that main branch are fast. Or
339       alternatively, -r doesn’t take any extra disk space, but may be
340       significantly slower for many operations, like cvs update.
341
342       If you want to refer to a git refspec that has characters that are not
343       allowed by CVS, you have two options. First, it may just work to supply
344       the git refspec directly to the appropriate CVS -r argument; some CVS
345       clients don’t seem to do much sanity checking of the argument. Second,
346       if that fails, you can use a special character escape mechanism that
347       only uses characters that are valid in CVS tags. A sequence of 4 or 5
348       characters of the form (underscore ("_"), dash ("-"), one or two
349       characters, and dash ("-")) can encode various characters based on the
350       one or two letters: "s" for slash ("/"), "p" for period ("."), "u" for
351       underscore ("_"), or two hexadecimal digits for any byte value at all
352       (typically an ASCII number, or perhaps a part of a UTF-8 encoded
353       character).
354
355       Legacy monitoring operations are not supported (edit, watch and
356       related). Exports and tagging (tags and branches) are not supported at
357       this stage.
358
359   CRLF Line Ending Conversions
360       By default the server leaves the -k mode blank for all files, which
361       causes the CVS client to treat them as a text files, subject to
362       end-of-line conversion on some platforms.
363
364       You can make the server use the end-of-line conversion attributes to
365       set the -k modes for files by setting the gitcvs.usecrlfattr config
366       variable. See gitattributes(5) for more information about end-of-line
367       conversion.
368
369       Alternatively, if gitcvs.usecrlfattr config is not enabled or the
370       attributes do not allow automatic detection for a filename, then the
371       server uses the gitcvs.allBinary config for the default setting. If
372       gitcvs.allBinary is set, then file not otherwise specified will default
373       to -kb mode. Otherwise the -k mode is left blank. But if
374       gitcvs.allBinary is set to "guess", then the correct -k mode will be
375       guessed based on the contents of the file.
376
377       For best consistency with cvs, it is probably best to override the
378       defaults by setting gitcvs.usecrlfattr to true, and gitcvs.allBinary to
379       "guess".
380

DEPENDENCIES

382       git-cvsserver depends on DBD::SQLite.
383

GIT

385       Part of the git(1) suite
386
387
388
389Git 2.33.1                        2021-10-12                  GIT-CVSSERVER(1)
Impressum