Pushing a local git repo to a bare remote

Often I create a git repo locally, but then want to push it to a remotely hosted repo.

On the server, create a folder and move into it, then:-

git init --bare

Then in your local git repo:-

git remote add origin ssh://username@yourserver/path/to/repo.git
git push --all origin

(this assumes your remote repo is accessible via ssh)