Skip to content

Instantly share code, notes, and snippets.

@roderik
Created June 21, 2010 12:49
Show Gist options
  • Save roderik/446800 to your computer and use it in GitHub Desktop.
Save roderik/446800 to your computer and use it in GitHub Desktop.
#!/bin/bash
ADMINUSER="gitadmin"
GITUSER="gitrepo"
SERVER="git.kunstmaan.be"
PROJECT=
while getopts "s:p:a:g:" OPTION
do
case $OPTION in
s)
SERVER=$OPTARG
;;
p)
PROJECT=$OPTARG
;;
a)
ADMINUSER=$OPTARG
;;
g)
GITUSER=$OPTARG
;;
esac
done
if [ -z $PROJECT ]; then
if [ -z "$1" ]; then
echo "Usage: git share -p <projectname>"
exit 1
else
PROJECT=$1
fi
fi
ssh ${ADMINUSER}@${SERVER} -o "PubkeyAuthentication no" "cd ~/gitosis-admin/; ~/gitosis-admin/manage -p ${PROJECT}"
git gc
git remote add origin ${GITUSER}@${SERVER}:${PROJECT}
git push origin master:refs/heads/master
git config branch.master.merge refs/heads/master
git config branch.master.remote origin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment