Subversion : Access to Repositories via HTTP2026/07/01 |
|
Access to Repositories via HTTP, without running [svnserve]. |
|
| [1] | |
| [2] |
Configure SSL/TLS to Apache2, refer to here. (Optional for this setting) |
| [3] | Install required packages. |
|
root@dlp:~# apt -y install libapache2-mod-svn
|
| [4] | Configure Apache2. For example, Set HTTP access to [/var/svn/repos/project] repository. |
|
root@dlp:~#
vi /etc/apache2/conf-available/subversion.conf # create new
<Location /project>
DAV svn
AuthType Basic
AuthName "DAV SVN"
AuthUserFile /var/svn/.svnpasswd
Require valid-user
SVNPath /var/svn/repos/project
</Location>
root@dlp:~#
a2enmod dav_svn root@dlp:~# a2enconf subversion root@dlp:~# chown -R www-data:www-data /var/svn/repos/project root@dlp:~# systemctl restart apache2 # add users root@dlp:~# htpasswd -Bc /var/svn/.svnpasswd ubuntu New password: Re-type new password: Adding password for user ubuntu |
| [5] | If also set access permission, Configure like follow. |
|
root@dlp:~#
vi /var/svn/repos/project/conf/authzsvn.conf # create new # set group [groups] developer = ubuntu,resolute operator = debian # everyone can [Read] access on root directory [/] * = r # only [developer] group can [Read/Write] under the [trunk] directory [project:/trunk] @developer = rw # only [operator] group can [Read/Write] under the [branches] directory [project:/branches] @operator = rw # only [operator] group can [Read/Write] under the [tags] directory [project:/tags] @operator = rw
root@dlp:~#
vi /etc/apache2/conf-available/subversion.conf
<Location /project>
DAV svn
AuthType Basic
AuthName "DAV SVN"
AuthUserFile /var/svn/.svnpasswd
Require valid-user
SVNPath /var/svn/repos/project
# add the line
AuthzSVNAccessFile /var/svn/repos/project/conf/authzsvn.conf
</Location>
root@dlp:~# systemctl reload apache2 |
| [6] | Verify settings to access via HTTP/HTTPS from any Hosts. |
|
resolute@node01:~$ svn --username ubuntu list https://dlp.srv.world/project Authentication realm: <https://dlp.srv.world:443> DAV SVN Password for 'ubuntu': ******** ----------------------------------------------------------------------- ATTENTION! Your password for authentication realm: <https://dlp.srv.world:443> DAV SVN can only be stored to disk unencrypted! You are advised to configure your system so that Subversion can store passwords encrypted, if possible. See the documentation for details. You can avoid future appearances of this warning by setting the value of the 'store-plaintext-passwords' option to either 'yes' or 'no' in '/home/resolute/.subversion/servers'. ----------------------------------------------------------------------- Store password unencrypted (yes/no)? no branches/ tags/ trunk/
resolute@node01:~$
resolute@node01:~/work$ echo 'store-plaintext-passwords = no' >> ~/.subversion/servers resolute@node01:~$ mkdir work resolute@node01:~$ cd work
svn --username ubuntu co https://dlp.srv.world/project Authentication realm: <https://dlp.srv.world:443> DAV SVN Password for 'ubuntu': ******** A project/branches A project/tags A project/trunk A project/trunk/index.html Checked out revision 4.
resolute@node01:~/work$
cd project/trunk
# after creating or editing any files under the repository, # try to [commit] with [debian] user resolute@node01:~/work/project/trunk$ echo index.html >> index.html resolute@node01:~/work/project/trunk$ svn --username debian ci index.html -m "update by debian"
Authentication realm: <https://dlp.srv.world:443> DAV SVN
Password for 'debian': ********
Sending index.html
Transmitting file data .svn: E195023: Commit failed (details follow):
svn: E195023: Changing file '/home/resolute/work/project/trunk/index.html' is forbidden by the server
svn: E175013: While preparing '/home/resolute/work/project/trunk/index.html' for commit
svn: E175013: Access to '/project/!svn/txr/6-6/trunk/index.html' forbidden
# denied normally as settings
# [commit] with [resolute] user resolute@node01:~/work/project/trunk$ svn --username resolute ci index.html -m "update by resolute"
Authentication realm: <https://dlp.srv.world:443> DAV SVN
Password for 'resolute': ********
Sending index.html
Transmitting file data .done
Committing transaction...
Committed revision 7.
# done normally as settings
|
| [7] | It's also possible to access on Web browser (read only). |
|
|
| Sponsored Link |
|
|