GIT与subgit和Apache的SVN

我已经开始评估一个名为subgit的软件,它可以无缝地与SVN或GIT进行回购。

在我们的整个组织中,我们使用apache来接口我们的回购,并试图将其与GIT结合起来变得有些麻烦。

总体而言,我们希望允许读取访问而不进行身份validation,并且写入应该通过身份validation,这与SVN正常工作,但似乎不像GIT那样简单。

除此之外,使用apache来识别是否是GIT / SVN请求,并找出客户端的位置,这样就可以使用相同的URL,而不pipe您使用的是什么回购系统。

下面是configuration,现在我们已经有适当的读访问没有身份validation的SVN和写访问与身份validation,但对于GIT它是R / W没有身份validation。

<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> 

任何input将不胜感激!

所以我真的设法解决这个问题:

 <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> 

至于评论的无缝整合,不,这不是完美的,但它是相当不错,足够的目的。

“SVN和git之间的无缝集成”是不可能的,底层模型太不同了。 查看git svn的文档,了解git世界中很多不能在SVN中完成的事情。 最好想一想从SVN迁移出来(上面提到的git svn可以很好的工作,可以顺利地从SVN回购,但是这样做太慢了,可以保留原来的备份和从现在开始使用git )。