Created
December 11, 2015 16:22
-
-
Save Caffe1neAdd1ct/118bd4a7aadff07e7005 to your computer and use it in GitHub Desktop.
Creating git repos via git-shell chsh configuration
This file contains hidden or 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
#!/bin/bash | |
# If no project name is given | |
if [ $# -lt 2 ] | |
then | |
# Display usage and stop | |
echo "Usage: create project-name.git \"Description of repo\""; | |
exit 1; | |
fi | |
# Set the project name, adding .git if necessary | |
project=$(echo "$1" | sed 's/\.git$\|$/.git/i') | |
shift && description=""; | |
for arg in "$@"; do | |
description="$description$1 " | |
shift; | |
done | |
# Create and initialise the project | |
mkdir "$project" && \ | |
cd "$project" && \ | |
git --bare init | |
# Create hooks | |
mkdir -p hooks | |
cp -R ~/git-shell-commands/hooks/ . | |
# Setup Email Hook | |
echo "[hooks]" >> config | |
echo " mailinglist = \"[email protected]\"" >> config | |
# Set project Description | |
echo "$description" > description |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment