jku logo
pervasive logo
Git simple Howto

Git Server

Create a git repository directory on the server.

mkdir /data/git/somename.git
cd /data/git/somename.git
git --bare init

You need ssh privileges on the server and not requiring a password. So add the developer SSH public keys to the "authorized_keys[2]" file.

local> ssh-keygen -t dsa -f .ssh/id_dsa
local> cd .ssh
local> scp id_dsa.pub user@remote:~/.ssh/id_dsa.pub
remote> cd .ssh
remote> cat id_dsa.pub >> authorized_keys2
remote> chmod 640 authorized_keys2
remote> rm id_dsa.pub
remote> exit

If your remote git server is running on a non standard Port enter them in your ".ssh/config"

Host remote
  Port XXX

Make a first import from locale

Branch is 'master', remote named 'origin'

cd somename
git init
git add .
git commit --allow-empty -m "init"
git remote add origin user@remote:/data/git/somename.git
git push origin master

Others can clone it down and push changes back. Of course they need also ssh access

git clone user@remote:/data/git/somename.git
git commit -am 'some changes'
git push origin master 

Keep it up-to-date

git pull origin master