GitマスターサーバをAmazon Linuxにインストールしてみる
Gitマスターサーバにgitをインストールする。
$ sudo yum install git git-all git-daemon $ git --version git version 1.7.4.5
xinetdを使ってgitサーバを起動する
sudo /etc/init.d/xinetd start
gitの設定ファイルでdisable = no に変更
sudo vi /etc/xinedt.d/git # default: off # description: The git damon 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=publ ic_git --syslog --inetd --verbose log_on_failure += USERID }
xinetdをrestartする。
sudo /etc/init.d/xinetd restart
リポジトリを作成する。
cd /var/lib/git sudo mkdir test cd test sudo git --bare init --shared sudo chmod 777 -R test
次にリモートのGitクライアントの設定
Gitをインストールする。
sudo yum install git
サンプルテキストの作成
mkdir ~/test cd ~/test vi test.txt aiueo
作成したテキストをcommitする
git init git add . git commit -m "First Commit"
リモートのGitマスターサーバに接続するためのSSHの設定をする
vi ~/.ssh/config Host ec2-xx-xx-xx-xx.ap-northeast-1.compute.amazonaws.com User ec2-user IdentityFile ~/.ssh/xxxxxx.pem sudo chmod 600 /home/ec2-user/.ssh/config sudo chmod 600 /home/ec2-user/.ssh/xxxxxx.pem
リモートのマスターを追加する
$ git remote add origin ssh://ec2-user@ec2-xx-xx-xx-xx.ap-northeast-1.compute.amazonaws.com/var/lib/git/test
リモートのマスターのリポジトリにpushする。
$ git push origin master
これで、マスター側の該当ディレクトリを見ると
$ ls -F branches/ config* description* HEAD* hooks/ info/ objects/ refs/
branchesディレクトリ等いろいろできている。
まだ確認できることはありそうだけど、今回はここまで。