add-git-repo

#!/bin/bash

if [ -z $1 ]; then
    echo Must provide the name of a new repo
    exit 1
elif [ ! -z $2 ]; then
    echo Must provide just the name a new repo
    exit 1
elif [ -e $1 ]; then
    echo This file exists already
    exit 1
fi

# https://git-scm.com/book/en/v2/Git-on-the-Server-Getting-Git-on-a-Server

dir="/home/git/$1.git"
mkdir "$dir"
chown git.git "$dir"
(cd "$dir" && sudo -u git git init --bare --shared)