Skip to content

Instantly share code, notes, and snippets.

@jacquarg
Created December 26, 2013 21:26
Show Gist options
  • Save jacquarg/8138908 to your computer and use it in GitHub Desktop.
Save jacquarg/8138908 to your computer and use it in GitHub Desktop.
Create a new git repository. To put in git-shell-commands, to be used with git-shell. Forked from http://planzero.org/blog/2012/10/24/hosting_an_admin-friendly_git_server_with_git-shell
#!/bin/sh
# If no project name is given
if [ $# -eq 0 ]
then
# Display usage and stop
echo "Usage: create <project.git>"
exit 1
fi
# Set the project name, adding .git if necessary
project=$(echo "$*" | sed 's/\.git$\|$/.git/i')
# Create and initialise the project
mkdir "$project" && \
cd "$project" && \
git --bare init
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment