Say you have a local development environment with all the source code which you would like to replicate/copy to a remote git server. You might like to do this because you want to share your development with others in your team, to backup your data somewhere else, or to be able to synchronize your project on different computers. How do you do that? Here's a step by step explanation:

1. First create a bare repository on your remote server:
remote # newgit myproject.git

2. Then, on your local server, inside your project directory initialize a local git repository:
local # git init

Next we will add all the files under current directory to be tracked.
local # git add .

And then, lets commit the changes so that the files to be tracked are really added:
local # git commit

3. Now, while still on your local server, set up your remote repositories:
local # git remote add origin ssh://username@server/~remoteHome/git/myproject.git

local # git config branch.master.remote origin

local # git config branch.master.merge refs/head/master

4. That is all the setup needed. Now you can push your project to the bare repository:
local # git push --all
If your git installation on the remote server is not on your path, you have to give --receive-pack=/path/to/git-receive-pack option to git-push command.

At this time your local development environment and the bare remote git server are synchronized. You can now clone it to a dummy directory if you would like to have another checked out copy on remote server:
remote # git-clone -l ~/git/myproject.git dummy

And later update the dummy project as needed:
remote # git pull

Check out my previous post about git commands (cheatsheet) if you want to know more about these commands.