Server setup

Git server

Create the git user which the git program will use:

sudo adduser git
su git
cd ~
mkdir .ssh && chmod 700 .ssh
touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys

Then add the allowed ssh-rsa public keys to the authorized_keys file.

To create a new git repository (bare, i.e. without a working directory):

git init --bare project.git

To setup the the new repository on another computer:

cd myproject
git init
git add .
git commit -m 'initial commit'
git remote add origin git@gitserver:project.git
git push origin master