#!/bin/sh # Copy git-scripts to an ssh-accessible remote host; # setup bare and non-bare repositories and the post-update hook. if [ $# -ne 3 ]; then echo "Usage: $0 [user@]host directory remote_name" >&2 exit 1 fi remote_host="$1" remote_dir="$2" remote_name="$3" ssh "$remote_host" "cd $remote_dir && exec git init --bare git-scripts.git" && git remote add "$remote_name" "$remote_host:$remote_dir/git-scripts.git" && git push "$remote_name" master && exec ssh "$remote_host" "cd $remote_dir && git clone git-scripts.git && cd git-scripts.git/hooks && exec ln -s ../../git-scripts/copy-scripts/post-update"