5. svnserve—Custom Subversion Server


svnserve允许Subversion版本库使用svn网络协议,你可以作为独立服务器进程运行svnserve,或者是使用其它进程,如inetd, xinetd(也是svn://)或使用svn+ssh://访问方法的sshd为你启动进程。

Regardless of the access method, once the client has selected a repository by transmitting its URL, svnserve reads a file named conf/svnserve.conf in the repository directory to determine repository-specific settings such as what authentication database to use and what authorization policies to apply. See 第 3 节 “svnserve - 定制的服务器 ” for details of the svnserve.conf file.

5.1. svnserve 选项

Unlike the previous commands we've described, svnserve has no subcommands—it is controlled exclusively by options.

--daemon (-d)

Causes svnserve to run in daemon mode. svnserve backgrounds itself and accepts and serves TCP/IP connections on the svn port (3690, by default).


When used together with -d, causes svnserve to stay in the foreground. This is mainly useful for debugging.

--inetd (-i)

导致 svnserve 使用 stdinstdout 文件描述符,适用于 inetd 守护进程。

--help (-h)


--listen-host HOST


--listen-once (-X)

Causes svnserve to accept one connection on the svn port, serve it, and exit. This option is mainly useful for debugging.

--listen-port PORT

Causes svnserve to listen on PORT when run in daemon mode. (FreeBSD daemons listen only on tcp6 by default—this option tells them to also listen on tcp4.)

--log-file FILENAME

Instructs svnserve to create (if necessary) and use the file located at FILENAME for Subversion operational log output of the same sort that mod_dav_svn generates. See 第 6 节 “High-level Logging” for details.

--pid-file FILENAME

Causes svnserve to write its process ID to FILENAME, which must be writable by the user under which svnserve is running.

--root (-r) ROOT

Sets the virtual root for repositories served by svnserve. The pathname in URLs provided by the client will be interpreted relative to this root and will not be allowed to escape this root.

--threads (-T)

When running in daemon mode, causes svnserve to spawn a thread instead of a process for each connection (e.g., for when running on Windows). The svnserve process still backgrounds itself at startup time.

--tunnel (-t)

Causes svnserve to run in tunnel mode, which is just like the inetd mode of operation (both modes serve one connection over stdin/stdout, and then exit), except that the connection is considered to be preauthenticated with the username of the current UID. This flag is automatically passed for you by the client when running over a tunnel agent such as ssh. That means there's rarely any need for you to pass this option to svnserve. So, if you find yourself typing svnserve --tunnel on the command line and wondering what to do next, see 第 3.4 节 “穿越 SSH 隧道”.

--tunnel-user NAME

Used in conjunction with the --tunnel option, tells svnserve to assume that NAME is the authenticated user, rather than the UID of the svnserve process. This is useful for users wishing to share a single system account over SSH, but to maintain separate commit identities.