First, start using git in your local directory:
cd root_of_project
git init
git add .
git commit -a -m 'initial commit'
Then set up an empty repository on your server:
ssh user@server
mkdir project.git
cd project.git
git --bare init
The --bare tells it to make the server just a repository with no
working directory tree. Then back on the client side, link the two:
git remote add origin ssh://user@server/~/project.git
Look in .git/config and make sure that you see the following:
[branch "master"]
remote = origin
merge = refs/heads/master
It should be set automatically, but sometimes it is not.
Finally, push your local repository to the server. The first time you do this, use the command:
git push origin master
Now you are set up. From now on, use “git push” to push
(committed) changes to the server, and “git pull” to merge server
changes into your local copy. To start another client, go to where
you want it and use:
git clone ssh://user@server/~/project.git [local directory name]
If you don’t specify [local directory name], it will copy the name
from the server.
From then on I mainly use, “git status“, “git add“,
“git commit -a“, “git push” and “git pull“. Every few months,
you can throw in a “git repack && git gc” for good measure.



