Generates a bare git repo from existing one and copy it to a central server
Bug

First things first, this doesn't work:


if [ "$1" == "--help" ] | [ $# -eq 0 ] ; then



You need || there, not |.

Local bare repo + copy vs remote bare repo + push

I completely agree with @Vogel that it would be better to create the bare repo on the remote, and then push to it:


git push is the simplest and safest way to transport Git repo data
Working with temporary dirs is messy. If your script gets killed in the middle, the cleaning at the end may not be reached (this could be improved by using trap)
The local bare clone unnecessarily doubles the .git storage space locally


Usability

The current script must be run in the parent directory of a Git repo,
as it is enforced by the [ ! -d "${LOCAL_REPO}" ] condition.
This is not convenient, and it doesn't have to be that way.

You could make it work with any valid path by making these two simple changes:

# LOCAL_REPO=$(basename $1)
LOCAL_REPO=$1

# NEW_REPO_DIRNAME=${LOCAL_REPO}.git
NEW_REPO_DIRNAME=$(basename "$LOCAL_REPO").git


Quoting

It's a good practice to double-quote variables used in command arguments.
For example instead of this:


LOCAL_REPO=$(basename $1)



It's good to make it a habit to write like this:

LOCAL_REPO=$(basename "$1")


(I trust you don't intend to ever create a repository with a space in the name, but this is still a good habit to pick up.)

The same goes for running the uses of $GIT and $SCP.

On the other hand, some quoting is unnecessary, for example you could write like this:

GIT=/usr/bin/git
SCP=/usr/bin/scp

if [ "$1" = --help ] || [ $# -eq 0 ] ; then


This is just for your information, it's ok the way you did it.

Only loosely related, but simply echo is the same as echo "".

Changing directories in scripts

Be careful with changing directories in scripts. If an error happens in the middle of the operation, the next operation may find itself in an unexpected directory (in the absence of adequate error handling).

Changing directories can become safer using (...) sub-shells. For example instead of this:


cd ${LOCAL_REPO}
$GIT remote add origin ${REMOTE_DIR}/${NEW_REPO_DIRNAME}
$GIT remote -v
cd ..



You could write like this (without the cd .. at the end):

(
    cd ${LOCAL_REPO}
    $GIT remote add origin ${REMOTE_DIR}/${NEW_REPO_DIRNAME}
    $GIT remote -v
)