Skip to content

Instantly share code, notes, and snippets.

@waffle2k
Created October 28, 2011 05:00
Show Gist options
  • Save waffle2k/1321662 to your computer and use it in GitHub Desktop.
Save waffle2k/1321662 to your computer and use it in GitHub Desktop.
Simple script for creating bare git projects.
#!/bin/bash
# This will create a new repository, with a sample README, and clone it
# to a default location
PROJNAME=$1
if [ -d /home/git/tmp/$PROJNAME ]; then
echo "Project by that name already exists"
exit 1
fi
# Create an empty project
mkdir -p /home/git/tmp/$PROJNAME
cd /home/git/tmp/$PROJNAME
git init
touch README
git add README
git commit -m "initial project"
# Clone it
git clone --bare /home/git/tmp/$PROJNAME /home/git/$PROJNAME.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment