SVN 仓库服务目前支持大多数主流 SVN 客户端。推荐使用各客户端的最新稳定版本。
进入项目
1. 登录 CODING 控制台,单击团队域名进入 CODING 使用页面。
2. 单击团队首页左侧的项目,进入项目列表页,选择目标项目。
3. 选择左侧菜单代码仓库,进入代码仓库首页。
Mac 环境
在 Mac 环境,可使用 Homebrew 安装 SVN 客户端。
1. 运行下面命令安装 Homebrew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2. Homebrew 安装好之后,在终端输入以下命令完成 SVN 安装:
brew install subversion
3. 使用命令
svn --version
验证 SVN 是否已正确安装:svn, version 1.9.7 (r1800392)compiled Feb 28 2018, 15:54:50 on x86_64-apple-darwin17.3.0Copyright (C) 2017 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 access (RA) modules are available:* ra_svn : Module for accessing a repository using the svn network protocol.- with Cyrus SASL authentication- handles 'svn' scheme* ra_local : Module for accessing a repository on local disk.- handles 'file' scheme* ra_serf : Module for accessing a repository via WebDAV protocol using serf.- using serf 1.3.9 (compiled with 1.3.9)- handles 'http' scheme- handles 'https' schemeThe following authentication credential caches are available:* Plaintext cache in /Users/Liwenqiu/.subversion* Mac OS X Keychain
4. 使用命令 ![](https://qcloudimg.tencent-cloud.cn/image/document/8e3cb398c5e769374777ece4ef1b557b.png)
svn checkout svn://subversion.e.coding.net/example/example-project
(请将地址替换为您的 SVN 仓库地址)来检出 SVN 仓库:
![](https://qcloudimg.tencent-cloud.cn/image/document/8e3cb398c5e769374777ece4ef1b557b.png)
5. 接下来可以使用 add、commit 命令往仓库中新添加内容:
![](https://qcloudimg.tencent-cloud.cn/image/document/02d71cafa39a46eb8bcdb18dd5adcfdc.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/02d71cafa39a46eb8bcdb18dd5adcfdc.png)
6. 除了使用 SVN 协议之外,还可以使用 ![](https://qcloudimg.tencent-cloud.cn/image/document/d116f162cdbda4fc78fe8a571ca0e6dc.png)
svn+ssh
协议来访问仓库,如下图所示:
![](https://qcloudimg.tencent-cloud.cn/image/document/d116f162cdbda4fc78fe8a571ca0e6dc.png)
Cornerstone 工具
您可以通过 Cornerstone 来使用 SVN 仓库。
1. 打开 Cornerstone 后,单击 Add Repostory 来添加 SVN 仓库(请将地址替换为您的 SVN 仓库地址)引用。
![](https://qcloudimg.tencent-cloud.cn/image/document/b5fb566307da1e44473ee982e54511cf.png)
然后可以看到仓库的内容如下:
![](https://qcloudimg.tencent-cloud.cn/image/document/bd9b8eacf30cf54dd47386c496bc92e9.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/b5fb566307da1e44473ee982e54511cf.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/bd9b8eacf30cf54dd47386c496bc92e9.png)
2. 把仓库 checkout 出来,并且编辑文件之后,就可以 commit 进仓库,如下图:
![](https://qcloudimg.tencent-cloud.cn/image/document/e1927dca3d2701e22eaf09cddf1049e4.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/e1927dca3d2701e22eaf09cddf1049e4.png)
Windows 环境
在 Windows 平台,推荐使用 TortoiseSVN。
1. 下载 安装完成之后,在任意文件目录单击鼠标右键。
![](https://qcloudimg.tencent-cloud.cn/image/document/199fda16fe6a5a31da78892a54a19f64.png)
选择
![](https://qcloudimg.tencent-cloud.cn/image/document/199fda16fe6a5a31da78892a54a19f64.png)
checkout
把 SVN 仓库 checkout
到本地(请将地址替换为您的 SVN 仓库地址)。![](https://qcloudimg.tencent-cloud.cn/image/document/6cb6e345c86c30831d7c9a07d0a33846.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/6cb6e345c86c30831d7c9a07d0a33846.png)
2. 第一次
checkout
需要输入用户名和密码。勾选“Save authentication”保存认证信息后,就不需要每次都输入密码。其中输入的用户名是 CODING 账号绑定的邮箱。
![](https://qcloudimg.tencent-cloud.cn/image/document/97bc3c3dc4fc927fffd966b4054ab9a6.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/97bc3c3dc4fc927fffd966b4054ab9a6.png)
3. 进入检出的文件夹,新建 ![](https://qcloudimg.tencent-cloud.cn/image/document/adf951d2738285a2d94309c2543022d5.png)
在空白处右键鼠标,选择 ![](https://qcloudimg.tencent-cloud.cn/image/document/785ca678f027e3b88e041c5e136cfee9.png)
README.md
文件。
![](https://qcloudimg.tencent-cloud.cn/image/document/adf951d2738285a2d94309c2543022d5.png)
SVN commit...
将新建的文件保存进版本库:
![](https://qcloudimg.tencent-cloud.cn/image/document/785ca678f027e3b88e041c5e136cfee9.png)
Linux 环境
在 Linux 下可以直接用系统的包管理工具安装 SVN。
在 Fedora 上用 yum 安装
$ sudo yum install subversion
在 Ubuntu 或 Debian 上用 apt-get 安装
$ sudo apt-get install subversion
安装成功之后,就可以用
svn checkout / commit
来访问 SVN 仓库。说明:
使用方法与在 Mac 平台使用命令行没有太大区别。
Ubuntu 下使用 SVN 命令行出现协商认证机制错误
在 Ubuntu 下使用 SVN 命令行客户端可能出现以下错误:
svn: E210007: Cannot negotiate authentication mechanism
这是由于 SVN 的认证过程使用到了 SASL 库来完成,所以需要运行以下命令安装依赖库来使用 SASL 认证:
$ sudo apt-get install cyrus-sasl2-dbg