Pushing a local git repo to a bare remote

This post was written 4 years ago.
Thu, 08 Nov 2012
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)
Tags: git /