summary refs log tree commit diff stats
path: root/git-init-remote
blob: 4d8cb292b60355aef0d7a4dd07a11fd51e99ace6 (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
33
#!/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 -n "Repo description: "; read
echo "ssh \"$GITREMOTE\" sh -c \"echo '$REPLY' > '$remote'\""
ssh "$GITREMOTE" sh -c "echo '$REPLY' > '$remote'"

# 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"