Creating a git repository

This procedure presumes you have an existing tree of software and ssh access to a remote host.

Setup parameters for your setup:

export PRJNAME=blork
export GITHOST=git.bonsai.com

Make sure the directory is pristine (ie, make clean, remove backup files etc.)

Initialize the git subdirectory:

cd root-of-project
git init

Add all of the files to git:

git add .
git commit -m 'initial import'

Create a bare clone:

git clone --bare . /tmp/${PRJNAME}.git

Rsync the bare clone to remote repository:

rsync -av /tmp/${PRJNAME}.git ${GITHOST}:git/
rm -rf /tmp/${PRJNAME}.git

Configure the remote repository URL:

git remote add origin ${GITHOST}:git/${PRJNAME}.git

Setup the branch config:

cat >> .git/config <<EOF
[branch "master"]
    remote = origin
    merge = refs/heads/master
EOF