summary refs log tree commit diff stats
path: root/git-init-remote
blob: a934c1ff97d5097ea108fa2d5467a4e7b33b4675 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh

GITREMOTE=git.acdw.net
GITROOT=/git

git ls-files > /dev/null || exit 1

# consider --git-dir as well .. however --git-dir would require more massaging
# of the output.
local="$(git rev-parse --show-toplevel)"
name="${local##*/}"

remote="$GITROOT/$name.git"

## Remote work

# Initiate the repository
echo "ssh \"$GITREMOTE\" git init --bare \"$remote\""
ssh "$GITREMOTE" git init --bare "$remote"

# Add a description
echo "ssh \"$GITREMOTE\" ed \"$remote/description\""
ssh "$GITREMOTE" ed "$remote/description"

# Add post-update-hook
echo "scp post-update.hook \"$GITREMOTE:$remote/hooks/post-update\""
scp post-update.hook "$GITREMOTE:$remote/hooks/post-update"

## Local work

echo "git remote add origin \"$GITREMOTE:$remote\""
git remote add origin "$GITREMOTE:$remote"