访问 SVN 仓库

最近更新时间:2023-11-17 15:22:21

我的收藏
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.0
Copyright (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' scheme
The following authentication credential caches are available:
* Plaintext cache in /Users/Liwenqiu/.subversion
* Mac OS X Keychain
4. 使用命令 svn checkout svn://subversion.e.coding.net/example/example-project(请将地址替换为您的 SVN 仓库地址)来检出 SVN 仓库:


5. 接下来可以使用 add、commit 命令往仓库中新添加内容:


6. 除了使用 SVN 协议之外,还可以使用 svn+ssh 协议来访问仓库,如下图所示:



Cornerstone 工具

您可以通过 Cornerstone 来使用 SVN 仓库。
1. 打开 Cornerstone 后,单击 Add Repostory 来添加 SVN 仓库(请将地址替换为您的 SVN 仓库地址)引用。

然后可以看到仓库的内容如下:


2. 把仓库 checkout 出来,并且编辑文件之后,就可以 commit 进仓库,如下图:



Windows 环境

在 Windows 平台,推荐使用 TortoiseSVN。
1. 下载 安装完成之后,在任意文件目录单击鼠标右键。

选择 checkout 把 SVN 仓库 checkout 到本地(请将地址替换为您的 SVN 仓库地址)。



2. 第一次 checkout 需要输入用户名和密码。勾选“Save authentication”保存认证信息后,就不需要每次都输入密码。
其中输入的用户名是 CODING 账号绑定的邮箱。


3. 进入检出的文件夹,新建 README.md 文件。

在空白处右键鼠标,选择 SVN commit... 将新建的文件保存进版本库:



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