コスギデンサン > 情報系メモ > GIT

GIT : サーバ側インストール 2016/11

GITのインストール
# yum install git-all

リポジトリのルートディレクトリの作成。
# mkdir /path/repos
# chown webgit.apache /path/repos
# chmod 770 /path/repos

Apacheとの連携
/etc/httpd/conf.d/gitrepo.conf
SetEnv GIT_PROJECT_ROOT /path/repos
SetEnv GIT_HTTP_EXPORT_ALL
SetEnv REMOTE_USER $REDIRECT_REMOTE_USER

ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/

<LocationMatch "^/git/">
  AuthType Basic
  AuthName "GIT Repository"
  AuthUserFile /path/repos/.git_htpasswd
  Require valid-user
</LocationMatch>

GitWebのインストール
# yum install gitweb

GitWebのApacheの設定
/etc/httpd/conf.d/gitweb.conf
Alias /gitweb /var/www/git

<Directory /var/www/git>
  Options +ExecCGI
  AddHandler cgi-script .cgi
  DirectoryIndex gitweb.cgi
</Directory>