Java Developer

Simple Git project repository using just git and ssh

When git was new, gitosis is commonly used to manage git-based projects. At the present, gitolite has replaced gitosis in popularity. But if you are just a single developer, or a small team with very few projects, you don't need any of these. Just plain git and ssh is enough.

First, you will need to setup a development server. You can read and follow this tutorial to setup a debian-based server. To recap, you need at a minimum to setup a password-less login to your server.

Create a user in your server where you will login to and store your project code.

$ adduser projectuser

Create ssh key pair in your desktop if you don't have any.

$ ssh-keygen

Upload your key to your server:

$ ssh-copy-id projectuser@server-ip-address

Install git on both your server and desktop:

$ apt-get install git-core

Now you can create and setup your project at the remote server:

$ pwd
/home/projectuser
$ mkdir awesome-project
$ cd awesome-project
$ git init
$ echo "Hello World" > readme.txt
$ git add .
$ git commit -a -m "Initial Commit"

And you can now clone the project in your desktop:

$ git clone ssh://projectuser@server-ip-address/home/projectuser/awesome-project

If you want a ready made solution without spending money, you can check-out bitbucket. The service is free for unlimited number of projects, for a team of maximum 5 members.
Tags: git, gitolite, gitosis, linux