GIT: how to set a private repository on your server

What you need

  • Server side: SSH access to the server + Git installed
  • Client side:Git shell ((Linux shell access, or Gui Bash for Windows)

Set up remote repository

#login to your server
# create repository
mkdir ~/myproject.git
# create empty repository
cd ~/myproject.git
git init --bare

Server: Set SSH keys

# only if you do not have an identity (~/.ssh/
ssh-keygen -t rsa
# copy public key to the server
cat ~/.ssh/ | ssh "cat >> ~/.ssh/authorized_keys"

in case youv’e specified a password for the RSA keys, and the password is asked all the time,¬†use ssh-agent

eval `ssh-agent`
# If the keys are set properly, you can now login to the server without specifying any password

Local machine: Clone the repository

cd ~/myProject
git clone ssh://
# make changes and commit
git add
git commit -a && git push

Some GIT tutorials / reference
Official Git tutorial
Git tutorial if you already know SVN
Git reference