Subversion Сравнение версий

Различия

Здесь показаны различия между двумя версиями данной страницы.

Ссылка на это сравнение

Предыдущая версия справа и слева Предыдущая версия
Следующая версия
Предыдущая версия
wiki:руководство_по_ubuntu_server:система_управления_версиями:subversion [2012/09/03 10:56]
[Методы доступа]
wiki:руководство_по_ubuntu_server:система_управления_версиями:subversion [2012/09/04 09:37] (текущий)
[Методы доступа]
Строка 46: Строка 46:
 В этом разделе мы рассмотрим как настроить Subversion для всех этих методов доступа. Здесь мы рассмотрим основное. Для более продвинутого использования,​ обратитесь к книге [[http://​svnbook.red-bean.com/​|svn book]]. В этом разделе мы рассмотрим как настроить Subversion для всех этих методов доступа. Здесь мы рассмотрим основное. Для более продвинутого использования,​ обратитесь к книге [[http://​svnbook.red-bean.com/​|svn book]].
  
-===Direct repository access ​(file://​)===+===Прямой доступ к хранилищу ​(file://​)===
  
-This is the simplest of all access methodsIt does not require any Subversion ​server process to be runningThis access method is used to access ​Subversion ​from the same machineThe syntax of the commandentered at a terminal promptis as follows:+Это самый простой из всех методов доступаОн не требует запуска какого-либо сервера ​Subversion. ​Этот метод используется для доступа к Subversion ​на этой же машинеСинтаксис командывводимой в терминалеаналогичен следующему: 
 +<​code>​svn co file:///​path/​to/​repos/​project</​code>​ 
 +или 
 +<​code>​svn co file://​localhost/​path/​to/​repos/​project</​code>​
  
-svn co file:///path/to/repos/project+<​note>​Если вы не указываете сетевое имя, требуется три прямых слеша в начале адреса (%%///%%) - два для обозначения протокола (в данном случае - file), плюс лидирующий слеш базового каталога. Если вы указываете сетевое имя, вы должны указать два слеша (%%//%%).</note>
  
-or+Права доступа к хранилищу определяются правами файловой системы. Если пользователь имеет право на чтение/​запись,​ он может получить содержимое хранилища и внести изменения.
  
-svn co file://​localhost/​path/​to/​repos/​project +===Доступ через протокол ​WebDAV (http://​)===
- +
-If you do not specify the hostname, there are three forward slashes (///) -- two for the protocol (file, in this case) plus the leading slash in the path. If you specify the hostname, you must use two forward slashes (//). +
- +
-The repository permissions depend on filesystem permissions. If the user has read/write permission, he can checkout from and commit to the repository. +
- +
-===Access via WebDAV ​protocol ​(http://​)=== +
- +
-To access the Subversion repository via WebDAV protocol, you must configure your Apache 2 web server. Add the following snippet between the <​VirtualHost>​ and </​VirtualHost>​ elements in /​etc/​apache2/​sites-available/​default,​ or another VirtualHost file:+
  
 +Для доступа к хранилищу Subversion через протокол WebDAV вам потребуется настроить сервер Apache2. Добавьте следующий фрагмент между элементами <​VirtualHost>​ и </​VirtualHost>​ в /​etc/​apache2/​sites-available/​default или иной VirtualHost файл:
 +<​code>​
  <​Location /svn>  <​Location /svn>
   DAV svn   DAV svn
Строка 72: Строка 69:
   Require valid-user   Require valid-user
  </​Location> ​  </​Location> ​
 +</​code>​
  
-The above configuration snippet assumes that Subversion ​repositories are created under /​home/​svn/ ​directory using svnadmin ​commandThey can be accessible using http://​hostname/​svn/​repos_name ​url.+<​note>​Фрагмент конфигурации выше предполагает,​ что хранилища ​Subversion ​созданы в каталоге ​/​home/​svn/ ​с использованием команды ​svnadmin. ​Они могут быть доступны по адресу %%http://​hostname/​svn/​repos_name%%.</​note>​
  
-To import or commit files to your Subversion ​repository over HTTP, the repository should be owned by the HTTP userIn Ubuntu ​systems, normally the HTTP user is www-data. ​To change the ownership of the repository files enter the following command from terminal prompt:+Для импорта или фиксации файлов в вашем ​Subversion ​хранилище по HTTP, хранилищем должен владеть ​HTTP пользовательВ Ubuntu ​системах обычно пользователем ​HTTP является ​www-data. ​Для изменения владельца файлов хранилища введите следующую команду в терминале: 
 +<​code>​sudo chown -R www-data:​www-data /​path/​to/​repos</​code>​ 
 +<​note>​Изменяя владельца хранилища на www-data вы не позволите импортировать или фиксировать файлы внутри хранилища командой %%svn import file:///%% любому пользователю кроме www-data.</​note>​
  
-sudo chown -R www-data:​www-data ​/path/to/repos+Далее вы должны создать файл /​etc/​subversion/​passwd,​ который будет содержать подробности аутентификации пользователей. Для создания файла используйте следующую команду в командной строке (которая создаст файл и добавит первого пользователя):​ 
 +<​code>​sudo htpasswd ​-c /etc/subversion/passwd user_name<​/code>
  
-By changing the ownership of repository as www-data you will not be able to import or commit files into the repository by running svn import file:/// command as any user other than www-data.+Чтобы добавить дополнительных пользователей,​ опустите опцию %%"-c"%%, поскольку она заменяет старый файл. Вместо этого используйте такой вариант: 
 +<​code>​sudo htpasswd ​/etc/subversion/passwd user_name</​code>​
  
-Nextyou must create the /etc/subversion/passwd file that will contain user authentication detailsTo create a file issue the following command at a command prompt (which will create the file and add the first user):+Эта команда запросит у вас ввод пароля. Как только вы введете парольпользователь будет добавлен. Теперь для доступа к хранилищу вы можете выполнить следующую команду:​ 
 +<​code>​svn co http://servername/svn</​code>​ 
 +<note important>​Пароль передается открытым текстомЕсли вы беспокоитесь о перехвате пароля,​ в стоит использовать шифрование SSL. Детали смотрите в следующей части.</​note>​
  
-sudo htpasswd -c /etc/subversion/​passwd user_name+===Доступ по протоколу WebDAV с шифрованием SSL (https://)===
  
-To add additional users omit the "-c" option as this option replaces the old fileInstead use this form:+Доступ к хранилищу Subversion по протоколу WebDAV с SSL шифрованием (%%https://​%%) аналогичен %%http://%% за исключением что вы должны установить и настроить цифровой сертификат для вашего Apache2 сервера. Для использования SSL с Subversion добавьте конфигурацию приведенную выше в файл /​etc/​apache2/​sites-available/​default-sslДля дополнительной информации по установке Apache2 с SSL смотрите [[wiki:руководство_по_ubuntu_server:​web_сервера:​httpd_apache2_web_server#​настройка_https|настройку HTTPS]].
  
-sudo htpasswd /​etc/​subversion/​passwd user_name+Вы можете установить цифровой сертификат,​ выпущенный центром сертификации. В качестве альтернативы можно использовать самоподписанный сертификат.
  
-This command will prompt you to enter the password. Once you enter the passwordthe user is addedNowto access the repository you can run the following command:+Эта часть подразумеваетчто вы установили и настроили цифровой сертификат в вашем сервере Apache2Теперь чтобы получить доступ к хранилищу Subversion смотрите предыдущий раздел. Метод доступа практически тот же самыйза исключением протокола. Вы должны использовать %%https://%% для доступа к хранилищу Subversion.
  
-svn co http://​servername/​svn +===Доступ через собственный протокол ​(svn://)===
- +
-The password is transmitted as plain text. If you are worried about password snooping, you are advised to use SSL encryption. For details, please refer next section. +
- +
-===Access via WebDAV protocol with SSL encryption (https://​)=== +
- +
-Accessing Subversion repository via WebDAV protocol with SSL encryption (https://) is similar to http:// except that you must install and configure the digital certificate in your Apache2 web server. To use SSL with Subversion add the above Apache2 configuration to /​etc/​apache2/​sites-available/​default-ssl. For more information on setting up Apache2 with SSL see HTTPS Configuration. +
- +
-You can install a digital certificate issued by a signing authority. Alternatively,​ you can install your own self-signed certificate. +
- +
-This step assumes you have installed and configured a digital certificate in your Apache 2 web server. Now, to access the Subversion repository, please refer to the above section! The access methods are exactly the same, except the protocol. You must use https:// to access the Subversion repository. +
- +
-===Access via custom protocol ​(svn://)=== +
- +
-Once the Subversion repository is created, you can configure the access control. You can edit the /​path/​to/​repos/​project/​conf/​svnserve.conf file to configure the access control. For example, to set up authentication,​ you can uncomment the following lines in the configuration file:+
  
 +Как только создано хранилище Subversion, вы можете настроить контроль доступа. Вы можете отредактировать файл /​path/​to/​repos/​project/​conf/​svnserve.conf для изменения контроля доступа. Например,​ для установки авторизации вы можете раскомментировать следующие строки в файле конфигурации:​
 +<​code>​
 # [general] # [general]
 # password-db = passwd # password-db = passwd
 +</​code>​
  
-After uncommenting the above linesyou can maintain the user list in the passwd ​fileSoedit the file passwd ​in the same directory and add the new userThe syntax is as follows+После снятия знака комментария (#) с этих строквы можете поддерживать список пользователей в файле ​passwd. ​И такредактируйте файл ​passwd ​в этом же каталоге и добавляйте новых пользователейСинтаксис должен быть таким
- +<​code>​username = password</​code>​ 
-username = password +Более подробно смотрите комментарии в самом файле.
- +
-For more details, please refer to the file. +
- +
-Now, to access Subversion via the svn:// custom protocol, either from the same machine or a different machine, you can run svnserver using svnserve command. The syntax is as follows:+
  
 +Теперь,​ чтобы подключиться к Subversion через собственный протокол %%svn://%%, с этой же машины или другой,​ вы можете запустить **svnserver** с помощью команды **svnserve**. Синтаксис следующий:​
 +<​code>​
 $ svnserve -d --foreground -r /​path/​to/​repos $ svnserve -d --foreground -r /​path/​to/​repos
-# -d -- daemon mode +# -d - режим сервиса 
-# --foreground -- run in foreground ​(useful for debugging+# --foreground - запуск в фоновом режиме ​(полезно при отладке
-# -r -- root of directory to serve +# -r - корневой каталог для обслуживания 
- +</​code>​ 
-For more usage detailsplease refer to+<​note>​Больше деталей по использованию можно посмотретьвыполнив команду
-$ svnserve --help +<​code>​$ svnserve --help</code><​/note>
- +
-Once you run this command, Subversion starts listening on default port (3690). To access the project repository, you must run the following command from a terminal prompt: +
- +
-svn co svn://hostname/​project project --username user_name +
- +
-Based on server configuration,​ it prompts for password. Once you are authenticated,​ it checks out the code from Subversion repository. To synchronize the project repository with the local copy, you can run the update sub-command. The syntax of the command, entered at a terminal prompt, is as follows: +
- +
-cd project_dir ; svn update +
- +
-For more details about using each Subversion sub-command,​ you can refer to the manual. For example, to learn more about the co (checkout) command, please run the following command from a terminal prompt: +
- +
-svn co help+
  
-===Access via custom protocol with SSL encryption ​(svn+ssh://)===+Как только вы выполните указанную команду,​ Subversion запустится на порту по умолчанию ​(3690). Для доступа к хранилищу проектов вам потребуется выполнить следующую команду из терминала:​ 
 +<​code>​svn co svn://hostname/​project project --username user_name</​code>​ 
 +Основываясь на конфигурации сервера,​ у вас будет запрошен пароль. После аутентификации будет проверен код из хранилища Subversion. Для синхронизации проекта из хранилища с локальной копией вам потребуется выполнить подкоманду update. Синтаксис команды,​ вводимой в терминале следующий:​ 
 +<​code>​cd project_dir ; svn update</​code>​
  
-The configuration and server process is same as in the svn:// method. For details, please refer to the above section. This step assumes you have followed the above step and started the Subversion server using svnserve command.+Для подробной информации о каждой подкоманде Subversion вы можете обратиться к встроенному руководству. Например,​ чтобы узнать больше о команде co (checkout) выполните следующую команду в терминале:​ 
 +<​code>​svn co help</code>
  
-It is also assumed that the ssh server is running on that machine and that it is allowing incoming connections. To confirm, please try to login to that machine using ssh. If you can login, everything is perfect. If you cannot login, please address it before continuing further.+===Доступ по собственному протоколу с SSL шифрованием (svn+ssh://)===
  
-The svn+ssh:// protocol is used to access the Subversion repository using SSL encryptionThe data transfer is encrypted using this methodTo access the project repository (for example with a checkout)you must use the following command syntax:+Настройка ​ и работа сервера такая же, как при %%svn://%% методеДетали описаны в предыдущей части.Этот шаг предполагаетчто вы следовали инструкциям предыдущей части и запустили сервер Subversion с помощью команды svnserve.
  
-svn co svn+ssh://​hostname/​var/​svn/​repos/​project+Также предполагается,​ что у вас на машине запущен сервер ​ssh и он разрешает входящие соединения. Для проверки,​ пожалуйста,​ попробуйте войти на машину с использованием ssh. Если вам удалось соединиться,​ все замечательно. Если соединиться не получилось,​ обратитесь к данной проблеме,​ прежде чем следовать дальше.
  
-You must use the full path (/​path/​to/​repos/​project) ​to access the Subversion ​repository using this access method.+Протокол %%svn+ssh://​%% используется для доступа к хранилищу Subversion с использованием SSL шифрования. Данные передаются шифрованными с использованием этого метода. Для доступа к проекту в хранилище (например,​ с командой checkout) вам нужно использовать следующую команду:​ 
 +<​code>​svn co svn+ssh://​hostname/​var/​svn/​repos/​project</​code>​ 
 +<​note>​Вы должны использовать полный путь ​(/​path/​to/​repos/​project) ​для доступа к хранилищу ​Subversion ​при этом методе подключения.</​note>​
  
-Based on server configurationit prompts for passwordYou must enter the password you use to login via ssh. Once you are authenticated,​ it checks out the code from the Subversion ​repository.+Основываясь на настройках серверабудет запрошен парольВы должны будете ввести пароль,​ который используете при доступе через ​ssh. После аутентификации команда проверит код из хранилища ​Subversion.
  
 ---- ----