SVN服务

安装

# 安装服务端和客户端
sudo apt install subversion

配置

创建仓库

# 将在/svn/svnrepos路径下创建仓库
svnadmin create /svn/svnrepos

修改配置

[general]
...
anon-access = none      # 匿名用户不能访问
auth-access = write     # 授权用户可读可写 ("write" allows complete read/write access to the repository)
password-db = passwd    # 密码文件位置
authz-db = authz        # 授权文件位置
...
# 修改/svn/svnrepos/conf/passwd添加用户
[users]
...
dfg = 123456
# 修改/svn/svnrepos/conf/authz添加授权
[repository:/]
dfg = rw

启动

# `-d`: 以守护进程模式运行。
# `-r`:指定 SVN 仓库的根目录。
svnserve -r /svn

客户端

# checkout 一个SVN仓库
svn checkout <repository_url> [local_directory] --username <user_name> --password <user_passwd>

# 更新
svn update

# 添加文件
svn add <file_or_directory>

# 提交更改
svn commit -m "Your commit message"

# 查看状态
svn status

# 查看日志
svn log

# 回滚
svn revert <file>

# 列出文件
svn ls <repository_url>

# 不导出.svn(版本控制信息)
svn export <repository_url>

# 读取文件内容
svn cat <repository_url>