]> git.ipfire.org Git - thirdparty/git.git/blob - Documentation/git-cvsserver.txt
cvsserver: Let --base-path and pserver get along just fine
[thirdparty/git.git] / Documentation / git-cvsserver.txt
1 git-cvsserver(1)
2 ================
3
4 NAME
5 ----
6 git-cvsserver - A CVS server emulator for git
7
8 SYNOPSIS
9 --------
10
11 SSH:
12
13 [verse]
14 export CVS_SERVER=git-cvsserver
15 'cvs' -d :ext:user@server/path/repo.git co <HEAD_name>
16
17 pserver (/etc/inetd.conf):
18
19 [verse]
20 cvspserver stream tcp nowait nobody /usr/bin/git-cvsserver git-cvsserver pserver
21
22 Usage:
23
24 [verse]
25 'git-cvsserver' [options] [pserver|server] [<directory> ...]
26
27 OPTIONS
28 -------
29
30 All these options obviously only make sense if enforced by the server side.
31 They have been implemented to resemble the gitlink:git-daemon[1] options as
32 closely as possible.
33
34 --base-path <path>::
35 Prepend 'path' to requested CVSROOT
36
37 --strict-paths::
38 Don't allow recursing into subdirectories
39
40 --export-all::
41 Don't check for `gitcvs.enabled` in config
42
43 --version, -V::
44 Print version information and exit
45
46 --help, -h, -H::
47 Print usage information and exit
48
49 <directory>::
50 You can specify a list of allowed directories. If no directories
51 are given, all are allowed. This is an additional restriction, gitcvs
52 access still needs to be enabled by the `gitcvs.enabled` config option
53 unless '--export-all' was given, too.
54
55
56 DESCRIPTION
57 -----------
58
59 This application is a CVS emulation layer for git.
60
61 It is highly functional. However, not all methods are implemented,
62 and for those methods that are implemented,
63 not all switches are implemented.
64
65 Testing has been done using both the CLI CVS client, and the Eclipse CVS
66 plugin. Most functionality works fine with both of these clients.
67
68 LIMITATIONS
69 -----------
70
71 Currently cvsserver works over SSH connections for read/write clients, and
72 over pserver for anonymous CVS access.
73
74 CVS clients cannot tag, branch or perform GIT merges.
75
76 git-cvsserver maps GIT branches to CVS modules. This is very different
77 from what most CVS users would expect since in CVS modules usually represent
78 one or more directories.
79
80 INSTALLATION
81 ------------
82
83 1. If you are going to offer anonymous CVS access via pserver, add a line in
84 /etc/inetd.conf like
85 +
86 --
87 ------
88 cvspserver stream tcp nowait nobody git-cvsserver pserver
89
90 ------
91 Note: Some inetd servers let you specify the name of the executable
92 independently of the value of argv[0] (i.e. the name the program assumes
93 it was executed with). In this case the correct line in /etc/inetd.conf
94 looks like
95
96 ------
97 cvspserver stream tcp nowait nobody /usr/bin/git-cvsserver git-cvsserver pserver
98
99 ------
100 No special setup is needed for SSH access, other than having GIT tools
101 in the PATH. If you have clients that do not accept the CVS_SERVER
102 environment variable, you can rename git-cvsserver to cvs.
103
104 Note: Newer cvs versions (>= 1.12.11) also support specifying
105 CVS_SERVER directly in CVSROOT like
106
107 ------
108 cvs -d ":ext;CVS_SERVER=git-cvsserver:user@server/path/repo.git" co <HEAD_name>
109 ------
110 This has the advantage that it will be saved in your 'CVS/Root' files and
111 you don't need to worry about always setting the correct environment
112 variable.
113 --
114 2. For each repo that you want accessible from CVS you need to edit config in
115 the repo and add the following section.
116 +
117 --
118 ------
119 [gitcvs]
120 enabled=1
121 # optional for debugging
122 logfile=/path/to/logfile
123
124 ------
125 Note: you need to ensure each user that is going to invoke git-cvsserver has
126 write access to the log file and to the database (see
127 <<dbbackend,Database Backend>>. If you want to offer write access over
128 SSH, the users of course also need write access to the git repository itself.
129
130 [[configaccessmethod]]
131 All configuration variables can also be overridden for a specific method of
132 access. Valid method names are "ext" (for SSH access) and "pserver". The
133 following example configuration would disable pserver access while still
134 allowing access over SSH.
135 ------
136 [gitcvs]
137 enabled=0
138
139 [gitcvs "ext"]
140 enabled=1
141 ------
142 --
143 3. On the client machine you need to set the following variables.
144 CVSROOT should be set as per normal, but the directory should point at the
145 appropriate git repo. For example:
146 +
147 --
148 For SSH access, CVS_SERVER should be set to git-cvsserver
149
150 Example:
151
152 ------
153 export CVSROOT=:ext:user@server:/var/git/project.git
154 export CVS_SERVER=git-cvsserver
155 ------
156 --
157 4. For SSH clients that will make commits, make sure their .bashrc file
158 sets the GIT_AUTHOR and GIT_COMMITTER variables.
159
160 5. Clients should now be able to check out the project. Use the CVS 'module'
161 name to indicate what GIT 'head' you want to check out. Example:
162 +
163 ------
164 cvs co -d project-master master
165 ------
166
167 [[dbbackend]]
168 Database Backend
169 ----------------
170
171 git-cvsserver uses one database per git head (i.e. CVS module) to
172 store information about the repository for faster access. The
173 database doesn't contain any persistent data and can be completely
174 regenerated from the git repository at any time. The database
175 needs to be updated (i.e. written to) after every commit.
176
177 If the commit is done directly by using git (as opposed to
178 using git-cvsserver) the update will need to happen on the
179 next repository access by git-cvsserver, independent of
180 access method and requested operation.
181
182 That means that even if you offer only read access (e.g. by using
183 the pserver method), git-cvsserver should have write access to
184 the database to work reliably (otherwise you need to make sure
185 that the database if up-to-date all the time git-cvsserver is run).
186
187 By default it uses SQLite databases in the git directory, named
188 `gitcvs.<module_name>.sqlite`. Note that the SQLite backend creates
189 temporary files in the same directory as the database file on
190 write so it might not be enough to grant the users using
191 git-cvsserver write access to the database file without granting
192 them write access to the directory, too.
193
194 You can configure the database backend with the following
195 configuration variables:
196
197 Configuring database backend
198 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
199
200 git-cvsserver uses the Perl DBI module. Please also read
201 its documentation if changing these variables, especially
202 about `DBI->connect()`.
203
204 gitcvs.dbname::
205 Database name. The exact meaning depends on the
206 used database driver, for SQLite this is a filename.
207 Supports variable substitution (see below). May
208 not contain semicolons (`;`).
209 Default: '%Ggitcvs.%m.sqlite'
210
211 gitcvs.dbdriver::
212 Used DBI driver. You can specify any available driver
213 for this here, but it might not work. cvsserver is tested
214 with 'DBD::SQLite', reported to work with
215 'DBD::Pg', and reported *not* to work with 'DBD::mysql'.
216 Please regard this as an experimental feature. May not
217 contain double colons (`:`).
218 Default: 'SQLite'
219
220 gitcvs.dbuser::
221 Database user. Only useful if setting `dbdriver`, since
222 SQLite has no concept of database users. Supports variable
223 substitution (see below).
224
225 gitcvs.dbpass::
226 Database password. Only useful if setting `dbdriver`, since
227 SQLite has no concept of database passwords.
228
229 All variables can also be set per access method, see <<configaccessmethod,above>>.
230
231 Variable substitution
232 ^^^^^^^^^^^^^^^^^^^^^
233 In `dbdriver` and `dbuser` you can use the following variables:
234
235 %G::
236 git directory name
237 %g::
238 git directory name, where all characters except for
239 alpha-numeric ones, `.`, and `-` are replaced with
240 `_` (this should make it easier to use the directory
241 name in a filename if wanted)
242 %m::
243 CVS module/git head name
244 %a::
245 access method (one of "ext" or "pserver")
246 %u::
247 Name of the user running git-cvsserver.
248 If no name can be determined, the
249 numeric uid is used.
250
251 Eclipse CVS Client Notes
252 ------------------------
253
254 To get a checkout with the Eclipse CVS client:
255
256 1. Select "Create a new project -> From CVS checkout"
257 2. Create a new location. See the notes below for details on how to choose the
258 right protocol.
259 3. Browse the 'modules' available. It will give you a list of the heads in
260 the repository. You will not be able to browse the tree from there. Only
261 the heads.
262 4. Pick 'HEAD' when it asks what branch/tag to check out. Untick the
263 "launch commit wizard" to avoid committing the .project file.
264
265 Protocol notes: If you are using anonymous access via pserver, just select that.
266 Those using SSH access should choose the 'ext' protocol, and configure 'ext'
267 access on the Preferences->Team->CVS->ExtConnection pane. Set CVS_SERVER to
268 'git-cvsserver'. Note that password support is not good when using 'ext',
269 you will definitely want to have SSH keys setup.
270
271 Alternatively, you can just use the non-standard extssh protocol that Eclipse
272 offer. In that case CVS_SERVER is ignored, and you will have to replace
273 the cvs utility on the server with git-cvsserver or manipulate your `.bashrc`
274 so that calling 'cvs' effectively calls git-cvsserver.
275
276 Clients known to work
277 ---------------------
278
279 - CVS 1.12.9 on Debian
280 - CVS 1.11.17 on MacOSX (from Fink package)
281 - Eclipse 3.0, 3.1.2 on MacOSX (see Eclipse CVS Client Notes)
282 - TortoiseCVS
283
284 Operations supported
285 --------------------
286
287 All the operations required for normal use are supported, including
288 checkout, diff, status, update, log, add, remove, commit.
289 Legacy monitoring operations are not supported (edit, watch and related).
290 Exports and tagging (tags and branches) are not supported at this stage.
291
292 The server should set the '-k' mode to binary when relevant, however,
293 this is not really implemented yet. For now, you can force the server
294 to set '-kb' for all files by setting the `gitcvs.allbinary` config
295 variable. In proper GIT tradition, the contents of the files are
296 always respected. No keyword expansion or newline munging is supported.
297
298 Dependencies
299 ------------
300
301 git-cvsserver depends on DBD::SQLite.
302
303 Copyright and Authors
304 ---------------------
305
306 This program is copyright The Open University UK - 2006.
307
308 Authors:
309
310 - Martyn Smith <martyn@catalyst.net.nz>
311 - Martin Langhoff <martin@catalyst.net.nz>
312
313 with ideas and patches from participants of the git-list <git@vger.kernel.org>.
314
315 Documentation
316 --------------
317 Documentation by Martyn Smith <martyn@catalyst.net.nz>, Martin Langhoff <martin@catalyst.net.nz>, and Matthias Urlichs <smurf@smurf.noris.de>.
318
319 GIT
320 ---
321 Part of the gitlink:git[7] suite