#!/bin/sh set -eu PRG=$(basename "$0") showhelp() { cat <&2 "${1:+ERROR: }${1:-Internal error!}" exit 1 } # parse cmdline options TEMP="`getopt -s sh -o h -l help -n "$PRG" -- "$@"`" || exit1 eval set -- "$TEMP" while true; do case "$1" in -h|--help) showhelp; exit;; --) shift; break;; *) exit1;; esac done PROJECT=${1-$(showhelp; exit1 "project name missing")} GIT_HOST=${2:-source.$(dnsdomainname --domain)} SSH_CONN=${3:-$GIT_HOST} ssh "$SSH_CONN" git init --bare --shared /srv/git/"$GIT_HOST"/"$PROJECT".git git remote add origin "$SSH_CONN":/srv/git/"$GIT_HOST"/"$PROJECT".git git push --set-upstream origin master