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

OPTIONS

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

DESCRIPTION

51       This application is a CVS emulation layer for Git.
52
53       It is highly functional. However, not all methods are implemented, and
54       for those methods that are implemented, not all switches are
55       implemented.
56
57       Testing has been done using both the CLI CVS client, and the Eclipse
58       CVS plugin. Most functionality works fine with both of these clients.
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 pserve 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:$1Oyx5r9mdGZ2
92                  myuser:$1$BA)@$vbnMJMDym7tA32AamXrm./
93
94           You can use the htpasswd facility that comes with Apache to make
95           these files, but Apache’s MD5 crypt method differs from the one
96           used by most C library’s crypt() function, so don’t use the -m
97           option.
98
99           Alternatively you can produce the password with perl’s crypt()
100           operator:
101
102                  perl -e 'my ($user, $pass) = @ARGV; printf "%s:%s\n", $user, crypt($user, $pass)' $USER password
103
104           Then provide your password via the pserver method, for example:
105
106                  cvs -d:pserver:someuser:somepassword <at> server/path/repo.git co <HEAD_name>
107
108           No special setup is needed for SSH access, other than having Git
109           tools in the PATH. If you have clients that do not accept the
110           CVS_SERVER environment variable, you can rename git-cvsserver to
111           cvs.
112
113           Note: Newer CVS versions (>= 1.12.11) also support specifying
114           CVS_SERVER directly in CVSROOT like
115
116               cvs -d ":ext;CVS_SERVER=git cvsserver:user@server/path/repo.git" co <HEAD_name>
117
118           This has the advantage that it will be saved in your CVS/Root files
119           and you don’t need to worry about always setting the correct
120           environment variable. SSH users restricted to git-shell don’t need
121           to override the default with CVS_SERVER (and shouldn’t) as
122           git-shell understands cvs to mean git-cvsserver and pretends that
123           the other end runs the real cvs better.
124
125        2. For each repo that you want accessible from CVS you need to edit
126           config in the repo and add the following section.
127
128                  [gitcvs]
129                       enabled=1
130                       # optional for debugging
131                       logFile=/path/to/logfile
132
133           Note: you need to ensure each user that is going to invoke
134           git-cvsserver has write access to the log file and to the database
135           (see Database Backend. If you want to offer write access over SSH,
136           the users of course also need write access to the Git repository
137           itself.
138
139           You also need to ensure that each repository is "bare" (without a
140           Git index file) for cvs commit to work. See gitcvs-migration(7).
141
142           All configuration variables can also be overridden for a specific
143           method of access. Valid method names are "ext" (for SSH access) and
144           "pserver". The following example configuration would disable
145           pserver access while still allowing access over SSH.
146
147                  [gitcvs]
148                       enabled=0
149
150                  [gitcvs "ext"]
151                       enabled=1
152
153        3. If you didn’t specify the CVSROOT/CVS_SERVER directly in the
154           checkout command, automatically saving it in your CVS/Root files,
155           then you need to set them explicitly in your environment. CVSROOT
156           should be set as per normal, but the directory should point at the
157           appropriate Git repo. As above, for SSH clients not restricted to
158           git-shell, CVS_SERVER should be set to git-cvsserver.
159
160                    export CVSROOT=:ext:user@server:/var/git/project.git
161                    export CVS_SERVER="git cvsserver"
162
163        4. For SSH clients that will make commits, make sure their server-side
164           .ssh/environment files (or .bashrc, etc., according to their
165           specific shell) export appropriate values for GIT_AUTHOR_NAME,
166           GIT_AUTHOR_EMAIL, GIT_COMMITTER_NAME, and GIT_COMMITTER_EMAIL. For
167           SSH clients whose login shell is bash, .bashrc may be a reasonable
168           alternative.
169
170        5. Clients should now be able to check out the project. Use the CVS
171           module name to indicate what Git head you want to check out. This
172           also sets the name of your newly checked-out directory, unless you
173           tell it otherwise with -d <dir_name>. For example, this checks out
174           master branch to the project-master directory:
175
176                    cvs co -d project-master master
177

DATABASE BACKEND

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

ENVIRONMENT

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

ECLIPSE CVS CLIENT NOTES

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

CLIENTS KNOWN TO WORK

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

OPERATIONS SUPPORTED

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

DEPENDENCIES

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

GIT

386       Part of the git(1) suite
387
388
389
390Git 2.30.2                        2021-03-08                  GIT-CVSSERVER(1)
Impressum