A simple script to create a new gitosis-repository on the fly. I’m not really familiar with bash scripting so don’t expect too much
#!/bin/bash
if [ -z $1 ]; then
echo "Please specify a repository."
exit 1
fi
if [ -z $2 ]; then
echo "Please specify a remote url."
exit 1
fi
if [ -d $1 ]; then
echo "Repository already exists."
exit 1
fi
mkdir $1
cd $1
git init
touch .gitignore
git add .gitignore
git commit -a -m "Initial commit."
git remote add origin $2:$1.git
git push origin master:refs/heads/master
Please make sure you set the correct permissions in gitosis.conf. Example:
[group me] members = me@example.com writable = test
Then you can run the script to create a new repository test on myhost.example.org:
$ gitosis-create-repo test git@myhost.example.org
1 Comment
kjikaqawej
10.12.2009 05:52
The script is nice and simple
. I started making one – for the server end – but then I decided to go take a look-see with a web search… stumbled on this one. Works exactly how I want it. Thanks you for sharing this.