Skip to content

Instantly share code, notes, and snippets.

@Caffe1neAdd1ct
Created December 11, 2015 16:22
Show Gist options
  • Save Caffe1neAdd1ct/118bd4a7aadff07e7005 to your computer and use it in GitHub Desktop.
Save Caffe1neAdd1ct/118bd4a7aadff07e7005 to your computer and use it in GitHub Desktop.
Creating git repos via git-shell chsh configuration
#!/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