环境配置二:Mac配置SVN工具

来源:互联网 发布:固态硬盘修复软件 编辑:程序博客网 时间:2024/06/02 20:23

最近写了几篇关于Mac配置和快捷键的文章,熟话怎么说的来着,什么成其事,必先利其器,反正就是这个意思,今天记录一下我在Mac配置SVN的过程。

1、 首次进行svn的搭建,创建svn目录 
在终端中输入:mkdir /Users/yibo/svn 回车


2、 创建svnrepository 
在终端中输入:svnadmin create/Users/yibo/svn/repository 


3、 查看svnrepository下的文件,终端中输入:ls 
/Users/username/svn/repository/ 下面六个文件(README.txt db  hooks  conf  format  locks)

 

4、 配置svn用户权限.

1.在终端中输入:ls  /Users/yibo/svn/repository/conf目录下有三个文件:authz  passwd  svnserve.conf

在终端中输入:vi authz,进入后按下i来修改文件:修改按下边来进行:

###Thisfile is an example authorization file for svnserve.

###Itsformat is identical to that of mod_authz_svn authorization

###files.

###Asshown below each section defines authorizations for the path and

###(optional)repository specified by the section name.

###Theauthorizations 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.

###

###Amatch can be inverted by prefixing the rule with '~'. Rules can

###grantread ('r') access, read-write ('rw') access, or no access

###('').

 

[aliases]

#joe= /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=ResearchInstitute/CN=JoeAverage

 

[groups]

# harry_sally_and_joe = harry,sally,&joe

 

[/]

#harry=123456

#&joe= r

#* =

 

#[repository:/baz/fuz]

#@harry_and_sally= rw

#* =r

将红色部分作如下修改:红色部分#harry_sally_and_joe=harry,sally,&joe 这里添加为username1_username2_……_and_usernamen=username1,username2,……,&usernamen,这里看你想要多少人使用你的svn在此处就添加几个名字,一定按格式填写。

在#harry=123456部分添加username1=userpassword,username2=userpassword (我猜是)当然按照提示还可以有其他的配置格式比如#*=password(我想应该是所有人的密码都设为同一个的做法)。记住这些用户名和密码下一步有用。

按下esc,输入:wq按回车保存并退出。

2.passwd还在当前目录下,在终端中输入vi passwd按照如下配置

 

###Thisfile is an example password file for svnserve.

###Itsformat is similar to that of svnserve.conf. As shown in the

###examplebelow it contains one section labelled [users].

###Thename and password for each user follow, one account per line.

 

[users]

username1 = userpassword

#sally= sallyssecret

输入用户名和password(就是刚才记住的那些)完了之后保存退出。

 

3.svnserve.conf还在当前目录下,终端输入vi svnserve.conf来配置服务器

###Thisfile controls the configuration of the svnserve daemon, if you

###useit to allow access to this repository. (If you only allow

###accessthrough http: and/or file: URLs, then this file is

###irrelevant.)

 

###Visithttp://subversion.apache.org/ for more information.

 

[general]

###Theseoptions control access to the repository for unauthenticated

###andauthenticated users.  Valid valuesare "write", "read",

###and"none".  The samplesettings below are the defaults.

anon-access = read

auth-access = write

###Thepassword-db option controls the location of the password

###databasefile.  Unless you specify a pathstarting with a /,

###thefile's location is relative to the directory containing

###thisconfiguration file.

###IfSASL is enabled (see below), this file will NOT be used.

###Uncommentthe line below to use the default password file.

password-db = passwd

###Theauthz-db option controls the location of the authorization

###rulesfor path-based access control. Unless you specify a path

###startingwith a /, the file's location is relative to the the

###directorycontaining this file.  If youdon't specify an

###authz-db,no path-based access control is done.

###Uncommentthe line below to use the default authorization file.

authz-db = authz

###Thisoption specifies the authentication realm of the repository.

###Iftwo repositories have the same authentication realm, they should

###havethe same password database, and vice versa.  The default realm

###isrepository's uuid.

#realm= My First Repository

 

[sasl]

###Thisoption specifies whether you want to use the Cyrus SASL

###libraryfor authentication. Default is false.

###Thissection will be ignored if svnserve is not built with Cyrus

###SASLsupport; to check, run 'svnserve --version' and look for a line

###reading'Cyrus SASL authentication is available.'

#use-sasl= true

###Theseoptions specify the desired strength of the security layer

###thatyou want SASL to provide. 0 means no encryption, 1 means

###integrity-checkingonly, values larger than 1 are correlated

###tothe effective key length for encryption (e.g. 128 means 128-bit

###encryption).The values below are the defaults.

#min-encryption= 0

#max-encryption= 256

注意红色部分一定要改过来。去掉#及空格

 

5、终端输入svnserve –d –r /Users/yibo/svn/repository

没有任何提示就说明启动成功了

如果你想要关闭svn服务器,最有效的办法是打开实用工具里面的“活动监视器

 

6、 将项目导入svn库.

svnimport /ProjectPathYouNeedToImport/  svn://localhost/svnroot/respository/ProjectName --username username --passwordpassword -m"comment information"

 

7、导出项目

svncheckout svn://localhost/svnroot/respository/ProjectName --username=username--password=password  /ThePathCheckoutTo/

 

8、如果是别的机器做的服务器,需要将localhost替换为服务器路径。

可编辑如下文件,添加名称到ip地址的映射。

sudovi /etc/hosts

如添加红色部分

##

#Host Database

#

#localhost is used to configure theloopback interface

#when the system is booting.  Do not change this entry.

##

127.0.0.1       localhost

255.255.255.255     broadcasthost

::1            localhost

fe80::1%lo0  localhost

192.168.14.1svnip

 

9、有用的命令

svnls svn:// svnip/svnpath 可以查询snv仓库内容

lsof-i :3690 查看svn是否启动

psaux | grep ‘svn’ 查找所有svn启动的进程id

kill-9 pid 将pid替换为上面查到的进程id可以杀掉svn进程

 

10、XCode配置svn

1)打开XCode

2)打开organizer,在左下角点+号,点AddRepository…

3)在弹出的界面中:

name可以随便起,Location输入为svn:// svnip/svnpath/ProjectName(路径名称什么的),按提示操作完成。

4)点organizer,在左下角点+号,点CheckoutorClone Repository…

5)在弹出的界面中:

Location输入svn:// svnip/svnpath/ProjectName,点击Checkout,在弹出的界面中选择想要保存到哪个路径。

这样就在本地得到了一份svn服务器上的项目,可以修改,更新,提交代码了(更新提交的操作在XCode菜单-->[File]-->[Source Control]下面)。

 


0 0
原创粉丝点击