Svn Install Svn安装配置
因为使用的是ubuntu, 安装相当简单,去软件管理器中输入svn就可以。或者使用
$ sudo apt-get install subversion
其实也没有怎么按照svn的安装流程走,那样的话需要添加新的用户,用户组。安全系数高一些。下面是自己的流程:
首先建一个svn目录,mkdir /home/cc/svn
在此目录下创建你自己的代码目录:
cd /home/cc/svn svnadmin create trunk //然后启动svn svnserve -d
–root=/home/cc/svn
如果想在trunk之下创建其他目录,可以直接使用mkdir director的方法。之后去其他机器使用svnclient.也可以使用刚才的apt-get
install subversion的方式。
svnserve.conf:12: Option
expected,产生的原因是没有顶格写。例如在/home/cc/svn/trunk/conf/svnserve.conf中:
[general] anon-access = none ### 这里auth-access的写法是错误的。 auth-access = write ###
这样写才是正确的 auth-access = write
svn : No access allowed to this repository
首先要把 svnserve.conf中的password-db = passwd注释去掉。然后在passwd文件中添加:
[users] cc = 123
在authz中添加:
[groups] ### 这里是建立一个组 user = cc,aa,bb,dd ###
这里repository:后添加的是相对路径,例如我的路径/home/cc/svn/trunk在这里就是/trunk [repository:/trunk]
这里@user是某一个组的权限 @user = rw ### 这是所有用户的权限 * = r
以后使用svn需要输入–username=cc --password=123
Authorization failed
这里是因为在authz中的路径可能设置有问题(repository:之后的那个路径,那里面的路径全部都是相对路径),或者是命令没有顶格写。passwd,
authz, svnserve.conf中的所有命令必须是顶格写的。
下面是远程机器使用svn导入项目:
svn import [本地目录] svn://[ip]/trunk -m "import project"即可.例如我的是 svn import
~/code/cnode svn://192.168.1.22/trunk -m “import” --username=cc
–password=123
这里要注意的是svn会将本地目录之下的所有东西都按照相同的组织方式放入到trunk.所有最好导入工程根目录。
贴一下写好的配置文件,这里我的trunk是pddms: authz
This file is an example authorization file for svnserve. ### Its format is
identical to that of mod_authz_svn authorization ### files. ### As shown below
each section defines authorizations for the path and ### (optional) repository
specified by the section name. ### The authorizations follow. An authorization
line can refer to: ### - a single user, ### - a group of users defined in a
special [groups] section, ### - an alias defined in a special [aliases]
section, ### - all authenticated users, using the ‘$authenticated’ token, ###
- only anonymous users, using the ‘$anonymous’ token, ### - anyone, using the
‘*’ wildcard. ### ### A match can be inverted by prefixing the rule with ‘~’.
Rules can ### grant read (‘r’) access, read-write (‘rw’) access, or no access
(‘’). [aliases] # joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil,
Ltd./OU=Research Institute/CN=Joe Average [groups] harry_and_sally =
cc,aa,bb,dd # harry_sally_and_joe = harry,sally,&joe [/] cc = rw # &joe = r #
- = [repository:/pddms] @harry_and_sally = rw * = r
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] cc = 123 aa = 123 # harry = harryssecret
sally = sallyssecret
svnserve.conf
This file controls the configuration of the svnserve daemon, if you
use it to allow access to this repository. (If you only allow ### access
through http: and/or file: URLs, then this file is ### irrelevant.) ### Visit
http://subversion.tigris.org/ for more information. [general] ### These
options control access to the repository for unauthenticated ### and
authenticated users. Valid values are “write”, “read”, ### and “none”. The
sample settings below are the defaults. 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 = pddms_a [sasl] ### This option specifies whether
you want to use the Cyrus SASL ### library for authentication. Default is
false. ### This section will be ignored if svnserve is not built with Cyrus
SASL support; to check, run ‘svnserve --version’ and look for a line
reading ‘Cyrus SASL authentication is available.’ # use-sasl = true ### These
options specify the desired strength of the security layer ### that you want
SASL to provide. 0 means no encryption, 1 means ### integrity-checking only,
values larger than 1 are correlated ### to the effective key length for
encryption (e.g. 128 means 128-bit ### encryption). The values below are the
defaults. # min-encryption = 0 # max-encryption = 256