CentOS 6.6 に git をインストール

今さらながら、Gitの構築手順について記載してみた。

事前準備
サーバ CentOS 6.x
SSH接続、及びコマンドライン操作がある程度できること

手順
1.Git ユーザーの作成とグループ設定
2.Git のインストール
3.リポジトリの作成

1. Git ユーザーの作成とグループ設定
・サーバにgit 用ユーザを作成
# useradd gituser

・git用ユーザーをグループに追加
# groupadd git
# usermod -G git gituser



2.Git のインストール
・gitのインストール
# yum install git git-daemon git-all xinetd

・Gitのバージョン確認
# git --version


・git-daemon ファイルを作成( vimなどでファイル作成)
# vi /etc/xinetd.d/git-daemon

git-daemon の内容

# default: off
# description: The git dæmon allows git repositories to be exported using \
#       the git:// protocol.

service git
{
       disable         = no
       socket_type     = stream
       wait            = no
       user            = nobody
       server          = /usr/libexec/git-core/git-daemon
       server_args     = --base-path=/var/lib/git --export-all --user-path=public_git --syslog --inetd --verbose
       log_on_failure  += USERID
}




・xinetd を再起動して有効化する。

# service xinetd restart


3.リポジトリの作成

# cd /var/lib/git
# mkdir public_git
# mkdir public_git/sample.git
# cd public_git/sample.git
# git --bare init --shared
git リポジトリのグループを gitグループに設定する。


# chown -R root:git /var/lib/git

コメント