Linux 新建svn项目

版权声明:本文为博主原创文章,未经博主允许不得转载 https://blog.csdn.net/qq_24909089/article/details/81869482

1.已安装svn的情况下,先进入svn版本库目录,需要root用户权限操作

2.创建版本库,先新建文件夹(mkdir -p 文件夹名),在添加svn版本库配置(svnadmin create appproject)

[root@iZ23hh6yk41Z svn]# pwd
/svn
[root@iZ23hh6yk41Z svn]# mkdir -p appproject
[root@iZ23hh6yk41Z svn]# ls
appproject
[root@iZ23hh6yk41Z svn]# svnadmin create appproject/
[root@iZ23hh6yk41Z svn]# cd appproject/
[root@iZ23hh6yk41Z appproject]# ls
conf  db  format  hooks  locks  README.txt
[root@iZ23hh6yk41Z appproject]#

3.进入conf配置文件夹

4.添加用户名密码,打开passwd,找到相应位置,添加一个用户名 gl=密码 123 另一个用户换行添加如下

[users]
# harry = harryssecret
# sally = sallyssecret
gl = 123
xyf = 456

5.设置用户权限,找到相应位置,添加内容如下。

(admin = gl,xyf) :添加一个admin用户组,里面有用户gl 和 xyf

[/] 一定要加 svn: E170001: 认证失败 就是因为没加这个

(@admin =rw) r是读的意思 w是写的意思,这个admin用户组有读写权限

(* = r) 星号是所有,其他用户都有读的权限

[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
admin = gl,xyf
# [/foo/bar]
# harry = rw
# &joe = r
# * =

# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
[/]   #[/]一定要加不然容易验证失败
@admin = rw
* = r

6.添加全局配置,找到相应的位置把前面的#号去掉或者直接在文件最下方添加

anon-access = read       #匿名用户可读
auth-access = write        #授权用户可写
password-db = passwd  #使用哪个文件作为账号文件
authz-db = authz            #使用哪个文件作为权限文件
realm =/svn/                   # 认证空间名,版本库所在目录

[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 = none
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
### The authz-db option controls the location of the authorization
### rules for path-based access control.  Unless you specify a path
### starting with a /, the file's location is relative to the the
### directory containing this file.  If you don't specify an
### authz-db, no path-based access control is done.
### Uncomment the line below to use the default authorization file.
authz-db = authz
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa.  The default realm
### is repository's uuid.
realm = /svn/
### The force-username-case option causes svnserve to case-normalize
### usernames before comparing them against the authorization rules in the
### authz-db file configured above.  Valid values are "upper" (to upper-
### case the usernames), "lower" (to lowercase the usernames), and
### "none" (to compare usernames as-is without case conversion, which
### is the default behavior).
# force-username-case = none

7.启动svn版本库: 在当前目录 svnserve -d -r svn库文件

不带端口号的地址:svnserve -d -r appproject/

带端口号的地址:svnserve -d -r appproject/ --listen-port 3700   

[root@iZ23hh6yk41Z svn]# svnserve -d -r appproject/ --listen-port 3700

8.本地下载svn库 :svn co svn://115.-------34:3700

猜你喜欢

转载自blog.csdn.net/qq_24909089/article/details/81869482