#!/usr/bin/env bash | |
basedir="/git/" | |
access_group="developers" | |
show_err() { | |
echo | |
echo "add-repo: an error occured." | |
echo | |
echo "Usage:" | |
echo " add-repo <repo_name>" | |
echo | |
echo "Check if base variables at the start of the script are set correctly." | |
echo "You may also need root privilages to run this script." | |
echo | |
exit 1 | |
} | |
if [ -z "$1" ]; then show_err; fi | |
trap show_err ERR | |
startdir="`pwd`" | |
repodir="$basedir$1.git" | |
sudo mkdir -p "$repodir" | |
cd "$repodir" | |
sudo git init --quiet --bare | |
sudo git config core.sharedRepository group | |
sudo chgrp -R $access_group . | |
sudo chmod -R g+rwX . | |
sudo find . -type d -exec chmod g+ws '{}' + | |
cd "$startdir" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment