#!/bin/bash # Make a new repo. declare -a extra_git_args if [ "$1" = "--sha256" ]; then extra_git_args+=( --object-format=sha256 ) shift fi if [ $# -ne 1 ]; then echo "Syntax: $0 [--sha256] " >&2 exit 1 fi if [[ $1 == *..* ]]; then echo "No .." >&2 exit 1 fi if [[ $1 == */* ]]; then echo "No /" >&2 exit 1 fi git init --shared --bare "${extra_git_args[@]}" "$HOME/$1.git" git -C "$HOME/$1.git" config --unset receive.denyNonFastForwards echo "Created $USER@$(hostname -f):$1.git"