]> git.phdru.name Git - git-scripts.git/blob - copy-scripts/copy-scripts
Feat(submodules/remove): Add option `-c`
[git-scripts.git] / copy-scripts / copy-scripts
1 #!/bin/sh
2
3 # Copy git-scripts to an ssh-accessible remote host;
4 # setup bare and non-bare repositories and the post-update hook.
5
6 if [ $# -ne 3 ]; then
7    echo "Usage: $0 [user@]host directory remote_name" >&2
8    exit 1
9 fi
10
11 remote_host="$1"
12 remote_dir="$2"
13 remote_name="$3"
14
15 ssh "$remote_host" "cd $remote_dir && exec git init --bare git-scripts.git" &&
16 git remote add "$remote_name" "$remote_host:$remote_dir/git-scripts.git" &&
17 git push "$remote_name" master &&
18 exec ssh "$remote_host" "cd $remote_dir && git clone git-scripts.git &&
19    cd git-scripts.git/hooks &&
20    exec ln -s ../../git-scripts/copy-scripts/post-update"