Subversion frontend server for git repository (java)
Java Shell XSLT Other
Latest commit 7dd5f9d Sep 15, 2017 @bozaro bozaro Merge pull request #132 from slonopotamus/parallel-indexing
Parallel indexing of repositories on startup

README.md

About project

Join the chat at https://gitter.im/bozaro/git-as-svn Build Status Download

Documentation links

You can read documentation by links:

What is it?

This project is an implementation of the Subversion server (svn protocol) for git repository.

It allows you to work with a git repository using the console svn, TortoiseSVN, SvnKit and similar tools.

Why do we need it?

This project was born out of division teams working on another project into two camps:

  • People who have tasted the Git and do not want to use Subversion (eg programmers);
  • People who do not get from Git practical use and do not want to work with him, but love Subversion (eg designers).

To divide the project into two repository desire was not for various reasons.

At this point, saw the project (http://git.q42.co.uk/git_svn_server.git with Proof-of-concept implementation svn server for git repository. After this realization svn server on top of git and didn't seem completely crazy idea (now it's just a crazy idea) and started this project.

Project status

Implementation status:

  • git submodules - partial
    • git submodules transparently mapped to svn
    • git submodules modification with svn not supported
  • git-lfs
  • svn properties - partial
    • some files one-way mapped to svn properties (example: .gitignore)
    • custom properties not supported
    • the commit requires that the properties of the commited file / directory exactly match the data in the repository
  • svn checkout, update, switch, diff - works
  • svn commit - works
  • svn copy, svn move - allowed copy and move commands, but copy information lost in repository
  • svn cat, ls - works
  • svn replay (svnsync) - works

System requirements

Server-side:

  • Java 8+
  • git repository

On the client side it is strongly recommended to use the tool with support for Subversion 1.8+.

SVN protocol description

GitLab integration

Now we support limited GitLab integration (see config-gitlab.example):

  • Load repository list from GitLab on startup (no dynamically update yet)
  • Authentication via GitLab API

LFS for Git SSH users (git-lfs-authenticate)

For support SSO git-lfs authentication you need to create file /usr/local/bin/git-lfs-authenticate with content:

#!/bin/sh
# TOKEN - token parameter in !lfs section
# BASE  - base url
TOKEN=secret
BASE=http://localhost:8123
curl -s -d "token=${TOKEN}" -d "external=${GL_ID}" ${BASE}/$1/auth/lfs

Also you need some GitLab patches:

  • #230 (gitlab-shell): Add git-lfs-authenticate to server white list (merged to 7.14.1);
  • #237 (gitlab-shell): Execute git-lfs-authenticate command with original arguments (merged to 8.2.0);
  • #9591 (gitlabhq): Add API for lookup user information by SSH key ID (merged to 8.0.0).
  • #9728 (gitlabhq): Show "Empty Repository Page" for repository without branches (merged to 8.2.0).

LFS for Git HTTP users

Reverse proxy

You need add git-as-svn to GitLab reverse proxy by modifying /var/opt/gitlab/nginx/conf/gitlab-http.conf file:

  • Add git-as-svn upstream server:
 upstream gitsvn {
   server      localhost:8123  fail_timeout=5s;
   keepalive   100;
 } 
  • Add resource redirection:
   location ~ ^.*\.git/info/lfs/ {
     proxy_read_timeout      300;
     proxy_connect_timeout   300;
     proxy_redirect          off;
 
     proxy_http_version  1.1;
     proxy_set_header    Connection          "";
 
     proxy_set_header    Host                $http_host;
     proxy_set_header    X-Real-IP           $remote_addr;
     proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;
     proxy_set_header    X-Forwarded-Proto   $scheme;
     proxy_set_header    X-Frame-Options     SAMEORIGIN;

     proxy_pass http://gitsvn;
   }

Also you need to set baseUrl parameter in !web section of git-as-svn configuration file.

How to use

Install on Ubuntu/Debian

You can install Git as Subversion by commands:

# Add package source
echo "deb https://dist.bozaro.ru/ debian/" | sudo tee /etc/apt/sources.list.d/dist.bozaro.ru.list
curl -s https://dist.bozaro.ru/signature.gpg | sudo apt-key add -
# Install package
sudo apt-get update
sudo apt-get install git-as-svn

Run from binaries

For quick run you need:

  • Install Java 1.8 or later
  • Download binaries archive from: https://github.com/bozaro/git-as-svn/releases/latest
  • After unpacking archive you can run server executing:
    bin/git-as-svn --config doc/config.example --show-config
  • Test connection:
    svn ls svn://localhost/example
    with login/password: test/test

As result:

  • Server creates bare repository with example commit in directory: example.git
  • The server will be available on svn://localhost/example/ url (login/password: test/test)