ubuntu 14.04.1 搭建svn服务器和使用

我是root 用户运行以下命令

1.安装svn

建议先先更新一下

apt-get update

apt-get install subversion

2.在home目录下创建文件夹

mkdir /home/svn

3.创建svn仓库

svnadmin create /home/svn/repository

4.修改配置文件conf/svnserve.conf

创建svn仓库时,repository目录下自动生成 

vim /home/svn/repository/conf/svnserve.conf

[general]
### The anon-access and auth-access options control access to the
### repository for unauthenticated (a.k.a. anonymous) users and
### authenticated users, respectively.
### Valid values are "write", "read", and "none".
### Setting the value to "none" prohibits both reading and writing;
### "read" allows read-only access, and "write" allows complete 
### read/write access to the repository.
### The sample settings below are the defaults and specify that anonymous
### users have read-only access to the repository, while authenticated
### users have read and write access to the repository.
anon-access = read
auth-access = write
### The password-db option controls the location of the password
### database file.  Unless you specify a path starting with a /,
### the file's location is relative to the directory containing
### this configuration file.
### If SASL is enabled (see below), this file will NOT be used.
### Uncomment the line below to use the default password file.
password-db = passwd
..... 

anno-access = read// 未经验证的用户及没有用户名和密码的用户如何访问 版本库

auth-access  = write//通过验证的用户及有用户名和密码的用户如何访问版本库

那么可选的值有三个:none,read,write  // none表示什么都干不了,read允许更新代码,write允许提交代码

vim /home/svn/repository/conf/passwd

### This file is an example password file for svnserve.
### Its format is similar to that of svnserve.conf. As shown in the
### example below it contains one section labelled [users].
### The name and password for each user follow, one account per line.
[users]
# harry = harryssecret
# sally = sallyssecret
yw = 123456
~               

vim vim /home/svn/repository/conf/authz

# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
admin = yw
@admin = rw
* = r

5.启动服务器

svnserve -d -r /home/svn    
ps -ef|grep svnserve 看看有没有此进程

6.导入工程

svn import  /home/myproject   svn://10.26.17.223:3690/repository/temp  -m  "我的工程"

7.将temp签出

cd /home/myproject

svn co svn://10.26.17.223:3690/repository/temp      //co ==checkout

8.往签出的 /home/myproject/temp下添加文件并提交到temp

cd /home/myproject/temp

vim test.cpp

svn add test.cpp

svn commit -m "添加我的第一件文件" test.cpp

9.更新版本

cd /home/svn/repository/temp

svn up

到这基本功能已完成。

猜你喜欢

转载自blog.csdn.net/lyw13522476337/article/details/80326571
今日推荐