How to host a git repository on your linux server. Reference: http://www.git-scm.com/book/en/Git-on-the-Server-Setting-Up-the-Server 0) prerequisites : - have a server running openssh with a static IP address and port 22 allowed - have git installed. It's usually already there by default, otherwise run $ sudo apt install git 1) create a git user $ sudo adduser git 2) for more security, restrict the user git to have a limited shell : $ sudo nano /etc/passwd change git:x:1000:1000::/home/git:/bin/bash (details may change) to git:x:1000:1000::/home/git:/usr/bin/git-shell (or run which git-shell to see where it’s installed) 3) create a directory where to put the git project, here called "project" $ sudo mkdir -p /home/git/gitprojects/project.git 4) Initialise the repository $ cd /home/git/gitprojects/project.git $ git --bare init 5) You can now use the repository from a remote computer, connecting via ssh $ git remote add origin git@static-IP-address:gitprojects/project.git $ git push origin master 6) you can also clone $ git clone git@static-IP-address:gitprojects/project.git For all these operations, you will be asked for the password of the user "git" on the server 7) for more security and more convenience, you can also configure authentication by RSA keys $ su git && cd ~ $ mkdir .ssh $ nano .ssh/authorized_keys paste here the RSA public keys of the users who are going to connect. Alternatively, if you have the key as a file, you can do $ cat /tmp/id_rsa_foobar.pub >> ~/.ssh/authorized_keys