Subversion : Access to Repositories via HTTP2024/07/24 |
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 -c /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,debian operator = noble # 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. |
noble@node01:~$ svn --username ubuntu list https://dlp.srv.world/project Authentication realm: <https://dlp.srv.world:443> DAV SVN Password for 'ubuntu': ******** branches/ tags/ trunk/
noble@node01:~$
noble@node01:~/work$ echo 'store-plaintext-passwords = no' >> ~/.subversion/servers noble@node01:~$ mkdir work noble@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.
noble@node01:~/work$
cd project/trunk
# after creating or editing any files under the repository, # try to [commit] with [noble] user noble@node01:~/work/project/trunk$ echo index.html >> index.html noble@node01:~/work/project/trunk$ svn --username noble ci index.html -m "update by noble"
Authentication realm: <https://dlp.srv.world:443> DAV SVN
Password for 'noble': ********
Sending index.html
Transmitting file data .svn: E195023: Commit failed (details follow):
svn: E195023: Changing file '/home/noble/work/project/trunk/index.html' is forbidden by the server
svn: E175013: While preparing '/home/noble/work/project/trunk/index.html' for commit
svn: E175013: Access to '/project/!svn/txr/4-4/trunk/index.html' forbidden
# denied normally as settings
# [commit] with [debian] user noble@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 .done
Committing transaction...
Committed revision 5.
# done normally as settings
|
[7] | It's also possible to access on Web browser (read only). |
![]() |
![]() |
Sponsored Link |