質量

特技は長座体前屈です

ローカルでpushしたら自動的にVPS上の公開用ディレクトリでpullする

Git初心者の自分用メモ。

bareリポジトリVPSに作って、 ローカルでpushしたら自動的VPS上の公開用ディレクトリでpullする。 (bareリポジトリはワーキングディレクトリをもたない)

bareリポジトリはワーキングディレクトリをもたない。 リポジトリ作る。

cd repos
mkdir shintyoku-bot.git
cd shintyoku-bot.git
git init --bare

サンプルを元にpost-receive書く。

cp hooks/post-receive.sample hooks/post-receive
echo "(cd /home/teshi/public/shintyoku-bot; git --git-dir=.git pull)" >> hooks/post-receive

公開用ディレクトリにクローン。

cd ~/public
git clone ../repos/shintyoku-bot.git

ローカルでgit remote add

git remote add origin ssh://name@hoge.jp/home/name/repos/shintyoku-bot.git

めっちゃ便利だ。