Last active
January 3, 2016 10:16
-
-
Save melmi/e43e1aa934c6d7852c1b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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