2014년 12월 11일 목요일

Apache 2.4 + Gitweb

개요
http/https protocol넘어로 git환경을 제공하기 위해 gitweb을 설정함.
기본적으로 push에 관해서는 http에서는 실시하지 않는 것으로, 어디까지나 외부의 공개나 부분적으로 key를 배포하고 싶지 않은 환경하에서 ip제약적으로 clone시키고 싶을 경우를 위한 http도입.

전제
apache 2.4

참고자료

https://wiki.archlinux.org/index.php/gitweb#Apache_2.4
http://git-scm.com/book/ko/v1/Git-%EC%84%9C%EB%B2%84-GitWeb

각 패스에 대한 설명

/gitweb : symbolic link collections to make public repository
/git : all the git repositories

수순

yum install gitweb

설정 파일 구성


/etc/gitweb.conf 
our $projectroot="/gitweb";

/etc/httpd/conf.d/git.conf 
<VirtualHost *:80>

ServerName git.???????.com

SetENV GIT_PROJECT_ROOT /gitweb
SetENV GIT_HTTP_EXPORT_ALL
SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER

ScriptAliasMatch \
        "(?x)^/git/(.*/(HEAD | \
                        info/refs | \
                        objects/(info/[^/]+ | \
                                 [0-9a-f]{2}/[0-9a-f]{38} | \
                                 pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
                        git-(upload|receive)-pack))$" \
        /usr/libexec/git-core/git-http-backend/$1

Alias /git /var/www/git

#grant pull
<LocationMatch "^/git/.*$">
  AllowOverride All
  Require all granted
</LocationMatch>

#block push
<LocationMatch "^/.*/git-receive-pack$">
  AllowOverride All
  Require all denied
</LocationMatch>

<Directory /var/www/git>

  Options +ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch

  AllowOverride All
  Require all granted

  AddHandler cgi-script .cgi
  DirectoryIndex gitweb.cgi

</Directory>



</VirtualHost>




----

댓글 없음:

댓글 쓰기