一、搭建svn服务器
svnadmin create /Users/apple/svnrepos/reposInstance
2.配置svn的用户权限
去掉注释符#和空格--要顶格
anon-access = read. (svn log 会出现问题,详见svn之E220001)
auth-access = write
password-db = passwd
authz-db = authz
3.打开passwd,在[users]下面添加帐号和密码
[users]
harry = harryssecret
sally = sallyssecret
userA=passwdA
4.打开authz,配置用户组和权限
[aliases]
joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average
[groups] //分组
harry_and_sally = harry,sally
harry_sally_and_joe = harry,sally,&joe
[/] // 所有数据
wbn=rw
[/foo/bar]
harry = rw
&joe = r
* =
[repository:/baz/fuz] //仓库:目录
@harry_and_sally = rw //分组加@
* = r
二、启动svn服务器
svnserve -d -r /Users/apple/svnrepos/reposInstance
对应关闭可以在活动监视器或者查看进程PID进行kill
ps -ef|grep svnserve.
501 2471 1 0 6:44上午 ?? 0:00.00 /Library/Developer/CommandLineTools/usr/bin/svnserve -d -r /Users/apple/svnrepos/reposInstance
501 2473 2398 0 6:45上午 ttys002 0:00.00 grep svnserve.
PID 为 2471
kill 2471
三、使用
1.从本地导入代码到服务器
svn import /Users/apple/proj svn://localhost/reposInstance/myproj --username=userA --password=passwordA -m "init"
(将prom下面的所有文件上传到了svn服务器reposInstance 仓库myproj下面)
2.checkout代码到本地
svn checkout svn://localhost/reposInstance/myproj --username=userA --password=passwordA proj
将myproj 改名为proj checkout到本地
注:svn://localhost/reposInstance/myproj 这个路径写到哪一级,.svn就在哪一级下面
比如svn://localhost/reposInstance/myproj ,.svn就在myproj下面
3.添加
svn add filename
4.更新
svn update
5.提交
svn commit -m "进行了一次提交"
6.打印
svn log ()