0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

git hookで分散バックアップ

0
Posted at

プッシュ後に別のWindowsの共有ディレクトリなどにクローンさせて分散バックアップを行います。

サーバーサイド(リモートリポジトリ)のhook/post-updateを作成し以下スクリプトを記述します。

to_clone_pathを変える事でクローンを作る場所を変更出来ます。

post-update
# !/bin/bash

# リポジトリの情報取得
localrepo_path=`pwd`
repo_name=`echo "${localrepo_path}" | sed "s/.*\///g"`
branch_name=`echo "${1}" | sed "s/.*\///g"`

# クローンを作成するフォルダのパスを指定
to_clone_path="//IPアドレス/共有ディレクトリのパス"

# クローン
git clone "${localrepo_path}" "${to_clone_path}_${branch_name}" -b "${branch_name}"
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?