Let's start with 2 machines. The first one, "remote", is where you want to store the code and could be where other users will also pull copy of the code from. The second one, "local", is the machine where you want to check out the code and make your edits.
On "remote" we want to store the repository in /usr/local/src:
git --bare init
On "local" we want to work on the code in ~/workspace and we already have some files to populate the repository with so we first create a local git repository:
git add .
Now let's push this code to the remote server:
git push ssh://
Done! Now we have both servers with the files. Files can be edited locally, commit locally and periodically synced/pushed to the remote server.
Now, on another computer, we want to "check out" the source code to work on it:
git clone ssh://
Some things to make it easier to work with:
1. Use ssh keys so that you don't have to put in your password each time you push to the remote host.