Mac上本地svn的搭建

2020-03-10  本文已影响0人  lmfei

最近因为一些原因公司的svn用不了,这可麻烦了,没有svn代码如何管理?没有远程svn只好搭建个本地来应对下这个特殊的时期,Mac又自带svn,简单方便,下面记录下搭建本地svn的步骤

首先看下我们svn的版本,打开终端输入指令

svnserve --version

打印信息

svnserve, version 1.10.3 (r1842928)
   compiled Apr  5 2019, 18:59:58 on x86_64-apple-darwin17.0.0

Copyright (C) 2018 The Apache Software Foundation.
This software consists of contributions made by many people;
see the NOTICE file for more information.
Subversion is open source software, see http://subversion.apache.org/

The following repository back-end (FS) modules are available:

* fs_fs : Module for working with a plain file (FSFS) repository.
* fs_x : Module for working with an experimental (FSX) repository.

Cyrus SASL authentication is available.

搭建代码仓库

终端创建代码仓库
  1. 建立svn目录
mkdir ./local_svn

2.初始化代码仓库

svnadmin create /Users/liumingfei/local_svn/repository
svn目录
  1. 配置SVN权限
    3.1 修改svnserve.conf文件配置用户权限


    svnserve.conf

    上图三个位置需要修改,具体含义是
    anon-access:表示匿名访问时的权限,read-只读、none-无权限
    3.2 修改passwd配置账号信息


    屏幕快照 2020-03-10 下午9.05.04.png

选中区域的意思为 用户名=密码
3.3 authz文件配置

屏幕快照 2020-03-10 下午9.13.51.png
第一红框设置用户组user,xxx为用户名,多个用户名使用,间隔
第二红框设置用户组的权限,[/]表示授权目录路径,如只允许访问根目录下的某个文件则表示为[/xxx/xxx],@表示给用户组设置权限,不使用@则表示授权给某用户
通过上面步骤,本地svn就配置好了
启动我们的svn服务
svnserve -d -r /Users/xxx/local_svn/

svn默认端口为80,如果想要使用其他端口可以使用

svnserve -d -r /Users/xxx/local_svn/ --listen-port 8080
关闭服务

通过活动监视器,关闭svnserve进程

使用Cornerstone连接svn

Repository Edit

如果需要通过局域网进行访问,可以将localhost缓存主机的ip,接下来代码管理就可以直接使用cornerstone进行了

使用指令进行代码管理

svn import /Users/apple/Documents/eclipse_workspace/weibo svn://localhost/local_svn --username=xxx --password=a123456 -m "导入文件"
svn checkout svn://localhost/local_svn --username=xxx --password=a123456 /Users/xxx
//更新
svn update
//提交代码
svn commit -m "描述"

生活如此美好,今天就点到为止。。。

上一篇 下一篇

猜你喜欢

热点阅读