Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've started evaluating a piece of software called subgit which seamlessly allows you to interface a repo with either SVN or GIT.

Throughout our organization we interface our repos using apache, and trying to combine this with GIT becomes somewhat troublesome.

Overall we want to permit read-access without authentication, and write should be authenticated, this works fine with SVN but doesn't seem to be as straight-forward with GIT.

In addition to this it would be neat to have apache identify whether it's a GIT/SVN request and figure out where to point the client so that you can use the same url regardless of what repo-system you're using.

Below is the config, right now we've proper read-access w/o auth for svn and write-access with auth, but for GIT it's r/w without authentication.

<VirtualHost *:80>
DocumentRoot /home/subgit/public_html
CustomLog /home/subgit/logs/access_log combined
SetEnv GIT_PROJECT_ROOT /home/subgit/repos/repo/
SetEnv GIT_HTTP_EXPORT_ALL
SetEnv REMOTE_USER $REDIRECT_REMOTE_USER
ScriptAlias /git/ /usr/lib/git-core/git-http-backend/
<LocationMatch "^/git/.*/git-receive-pack$">
  Options +ExecCGI
AuthType Basic
AuthName "subgit"
AuthBasicProvider file
AuthUserFile /home/subgit/etc/subgit
Require valid-user
  Allow From All
</LocationMatch>
<LocationMatch "/svn">
  DAV svn
  SvnPath /home/subgit/repos/repo
AuthType Basic
AuthName "subgit"
AuthBasicProvider file
AuthUserFile /home/subgit/etc/subgit
  AuthzSVNAccessFile /home/subgit/etc/subgit.access
      <LimitExcept GET PROPFIND OPTIONS REPORT>
          Require valid-user
      </LimitExcept>
</LocationMatch>
</VirtualHost>

Any input would be appreciated!

share|improve this question
add comment

2 Answers

Soo I actually managed to fix this myself:

<VirtualHost *:80>
DocumentRoot /home/subgit/repos

    <Directory /home/subgit/repos>
        Options       None
        AllowOverride none
        Order         allow,deny
        Allow         from all
    </Directory>

CustomLog /home/subgit/logs/access_log combined
SuexecUserGroup subgit subgit
ScriptAlias /git/ /home/subgit/bin/gitolite-suexec-wrapper.sh/
RewriteEngine On
RewriteCond %{QUERY_STRING} service=git-receive-pack [OR,NC]
RewriteCond %{REQUEST_URI} ^/git/.*/git-receive-pack$ [NC]
RewriteRule .* - [E=AUTHREQUIRED:yes]

 <LocationMatch "/git/">
    Order Allow,Deny
    Deny from env=AUTHREQUIRED
    Allow from all
    Satisfy Any
    AuthType Basic
    AuthName "subgit"
    AuthBasicProvider file
    AuthUserFile /home/subgit/etc/subgit
    Require valid-user
  </LocationMatch>
  <LocationMatch "/svn">
    DAV svn
    SvnPath /home/subgit/repos/testrepo
    AuthType Basic
    AuthName "subgit"
    AuthBasicProvider file
    AuthUserFile /home/subgit/etc/subgit
    AuthzSVNAccessFile /home/subgit/etc/subgit.access
    <LimitExcept GET PROPFIND OPTIONS REPORT>
      Require valid-user
    </LimitExcept>
  </LocationMatch>
</VirtualHost>

As far as the comments goes on seamless integration, no it's not perfect but it's pretty good and good enough for the purpose.

share|improve this answer
add comment

"Seamless integration between SVN and git" is impossible, the underlying models are too different. Look at the documentation for git svn for a long list of things that are natural in the git world that can't be done in SVN. Better think of migrating off SVN (the mentioned git svn works fine to slurp down a SVN repo, but doing that is slow as molasses; can keep the original around for backup and work with git from now on).

share|improve this answer
1  
-1 for two reasons: a) the problem is to properly setup Apache server, your answer does not give any insight on that; b) I can find the long list of the things git svn can not handle well, that does not prove that "seamless integration between SVN and Git is impossible". Indeed, the underlying models are different, however, the significant part of information stored in Subversion repository can be represented by Git data model and the same holds in opposite direction. –  vadishev Feb 27 '13 at 11:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.