#!/bin/bash set -eu remote="git.pi" cmd=${1:-""} if [ "$cmd" == "init" ]; then name="$2" if [ ! -d "$name" ]; then mkdir $name fi; cd $name ssh git@git.pi "./create-repo.sh $name" if [ ! -d ".git" ]; then git init fi; git remote add local "git@$remote:$name.git" elif [ "$cmd" == "clone" ]; then name="$2" git clone "git@$remote:$name.git" $name else echo "usage: gitlocal (init|clone) repository remote: $remote init: initialize repository on the remote server, then create a local folder linked to the remote clone: clone a git repository from the remote"; fi;