This simple bash script publish a new git repository on remote server, it script is based you are creating a new git repository.
This script was based on dreamgit.sh from dreamhost wiki.
#!/bin/bash
# set -x ## debug
SERVER_REPOS="/path/to/repos.git"
LOCAL_REPOS="/path/to/Repositories"
DREAMGIT_DOMAIN=user@host.domain.com
cd $LOCAL_REPOS
ssh $DREAMGIT_DOMAIN 'mkdir -p '$SERVER_REPOS/$1'.git && cd '$SERVER_REPOS/$1'.git && git --bare init'
mkdir $1
cd $1
git init
git remote add origin ssh://$DREAMGIT_DOMAIN$SERVER_REPOS/$1.git
touch .gitignore
git add .
git commit -m 'New repository created'
git push origin master
echo "
[branch \"master\"]
remote = origin
merge = refs/heads/master" >>.git/config
echo "New repository '$1' was created and iniatialized on $DREAMGIT_DOMAIN$SERVER_REPOS/$1.git"