SVN进行代码的托管

svn 使用的是集中服务器 就是只有一个服务器的意思

git 是分布式服务器

 服务器:

存储客户端上传的源代码。

可以在Windows上通过安装 Visual SVN Sever 。

 客户端:

上传代码到服务器,或者更新服务器的代码到本地,保持同步。

服务器的搭建:

在windows系统上可以安装 VisualSVNSever 或 TortoiseSVN 软件来搭建 Svn 环境,由于Mac自带了svn的服务器端和客户端功能,所以我们可以在不装任何第三方软件的前提下使用svn功能,不过还需做一下简单的配置

 

进入 SVN China  官网注册账号。

1.建立连接,就是添加自己的链接,建立自己的项目本地路径,保证开发者在一个服务上面。

2.项目经理把框架 import  到服务器上,组长就可以把自己电脑上的本地的服务器框架删掉。

3.团队个人从服务器上获取框架, check  out  

4.分别编码(切记重要的是,不要多人去修改一个文件<有可能是在以前过期的版本上修改,会不能成功,这时候要 组员商定后 点 resolve 解决按钮>)

5.上传自己的代码,commit 

6.其他人去更新代码  update

 

其他按钮的按钮的作用:

compare With HEAD 会出现两个面板,服务器上的代码,与本地我的代码是否存在没有更新的东西。如果发现不一样就赶快 Update 

log  就是我们在提交的时候,修改的时候打上去的注释,用于记录修改原因,版本,以及其他的说明

translation  能把你今天对框架里面做了什么操作,都显示出来,上传了什么代码?下载了什么代码?修改了什么代码?

 

在这个SVn 里面本地的文件是操作的副本,只有上传到Svn  服务器上的才是真正的框架原本(*这里要注意一下,所以我们在更新一下真正的之后就可以把本地的删除)

 

 下面简单的操作一下使用 SVN 进行完成项目的管理工作。

 

在Mac环境下搭建svn服务器端环境。

1、创建代码仓库,用来存储客户端所上传的代码。

 

先在电脑的账户目录下面建一个文件夹 Svn Repositories  用来存储所有 svn 管理的代码仓库。操作如下

 

 

 

MACdeMacBook-Pro:SvnRepositories  mac$ cd /Users/mac/SvnRepositories\  
MACdeMacBook-Pro:SvnRepositories  mac$ svnadmin create /Users/mac/SvnRepositories/mycode
svnadmin: E000002: Repository creation failed
svnadmin: E000002: Could not create top-level directory
svnadmin: E000002: Can't create directory '/Users/mac/SvnRepositories/mycode': No such file or directory
MACdeMacBook-Pro:SvnRepositories  mac$ 

 

 

上面的错误是因为不能再一个同名的文件夹中创建一个同名的仓库的原因。

 

MACdeMacBook-Pro:SvnRepositories  mac$ svnadmin create /Users/mac/svn/repository 
svnadmin: E000002: Repository creation failed
svnadmin: E000002: Could not create top-level directory
svnadmin: E000002: Can't create directory '/Users/mac/svn/repository': No such file or directory
MACdeMacBook-Pro:SvnRepositories  mac$ 

 

上面的命令也是错误的,原因是在创建的时候确保已经svn/repository已经存在,上面的错误就是我没有创建svn/repository造成的

 

 

如果在终端输入svnadmin create /Users/mac/svn/repository 代码,无提示说明创建成功,如下图所示:

 

 

 

 

在账户下面可以看到 svn下面有个 erpository 代码仓库。

 

 

     

 

 

 配置  svn 用户权限/Users/mac/svn/repository/conf/目录下存在3个文件: authz、passwd、snvserve.conf

   

你可以选择使用文本编辑打开,也可以使用终端打开

 

1.打开 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]
# admins是组名,admin是组员,可以写多个,用”,“分隔.如admins=admin,master  
admins=admin 

# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe

# [/foo/bar]
# harry = rw
# &joe = r
# * =

# 设置/目录权限  
[/]  

# 这里的意思是admins组的成员都有rw的权限,rw是读写得权限,也可以写成admin=rw,只赋予某一个用户有读写权限  
@admins=rw   

# 这里如果不写的意思是,下一级目录的用户不具备继承关系,也就是没有访问/的权限,* = r,就是别>的用户只能远观了, * = rw,就让其他的用户也有继承关系了,就是也可具备读写权限  
* =   

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

 

 2、打开 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]

# authz 的用户名对应起来,后面是用户密码  
admin=123456   

# harry = harryssecret
# sally = sallyssecret

 

3、打开 svnserve.conf 文件夹,然后再修改为如下:(svn 的配置信息)

### 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.apache.org/ for more information.

[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 匿名用户有读写权限
# 禁用匿名用户读的权限  (read 改为 none)
 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.

# 这里需要放开注释,关联passwd.
 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
### directory containing this file.  The specified path may be a
### repository relative URL (^/) or an absolute file:// URL to a text
### file in a Subversion repository.  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
 authz-db = authz
 
### The groups-db option controls the location of the file with the
### group definitions and allows maintaining groups separately from the
### authorization rules.  The groups-db file is of the same format as the
### authz-db file and should contain a single [groups] section with the
### group definitions.  If the option is enabled, the authz-db file cannot
### contain a [groups] section.  Unless you specify a path starting with
### a /, the file's location is relative to the directory containing this
### file.  The specified path may be a repository relative URL (^/) or an
### absolute file:// URL to a text file in a Subversion repository.
### This option is not being used by default.
# groups-db = groups
### 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 = My First Repository
### 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
### The hooks-env options specifies a path to the hook script environment
### configuration file. This option overrides the per-repository default
### and can be used to configure the hook script environment for multiple
### repositories in a single file, if an absolute path is specified.
### Unless you specify an absolute path, the file's location is relative
### to the directory containing this file.
# hooks-env = hooks-env

[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

 

下面我们开始启动服务器,命令如下所示:

 

 

svnserve 启动svn服务; -d 标示svnserve将会作为一个服务程序运行在后台 -r 标示将/Users/mac/svn/repository/作为根目录(网络搜索的,忘求证)

 

向svn库导入一个根目录

不能连接上上面的 svn 本地服务器,这是怎么回事啊?后来我将服务器后面添加了一个 5555 的端口,结果访问服务器,还是不能导入根目录成功。

后来打开了上面配置的三个svn本地服务器的文件,检查了一下,是原来是在每一个设置的行前面有空格,我把空格去掉就可以了。测试能够连接成功了。( 主要是 svnserve.conf  文件里面,的有效设置行都要定投写,svn服务器的配置相当比较敏感空格)链接

 参照 链接 的博客没有实验成功在终端里向服务器里添加一个 svnroot 根目录。 《后期有时间了再搞一下吧,这里先笔记到此》

 

下面是直接实验使用 CornerStone 工具来进行检出、修改、提交代码。

 

1、新建一个   Repository

 

2. 配置svn server

 

 

3. 等待片刻,提示成功,显示一下界面

 

 

svn服务器用户的权限管理

 

 

参考链接:链接1 链接2

转载于:https://www.cnblogs.com/benpaobadaniu/p/4876601.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值