How to install git server on my ubuntu desktop 12.04

I'm developing a project on my desktop and I'm in need of a version control mechanism. I'm working on ubuntu 12.04, desktop edition.

I would like to have a git server installed on localhost and also the client will be installed in the same computer.

It's easy to install the client but I can't find a full explained guide of how to install the server..

I found a guide of installing gitosis but it's no longer supported (not supported on ubuntu 12.04)


Solution 1:

You shouldn't need to install a Git server on your local machine to work with Git. Git is a distributed version control system (DVCS), ss such there really is no idea of a Client and Server. Instead you just have clients, as many clients as you want, which can talk to each other.

So when you type git init in a directory and create a git repository, you've got all you'll need to commit, merge, branch, and ultimately use git. For all intensive purposes, this is the master source, the "god" source, equivalent to the SVN server. Unlike in subversion, where there is a centralized source, only one true "god"/master copy, Git works in a way that everyone who clones a git repository has their own "god"/master copy. So when you share code, each person gets the theoretical equivalent of an SVN server on their machine in the form of a portable git repository. This strongly differs from the centralized model (and lends to it's distributed nature) where if your source becomes deleted it does not affect anyone else. In fact if you lose your source you can clone from someone else who has a copy of the repository and continue as if nothing happened. So long as N+1 people have a copy of the code, if all of N lose it the code will live on.

What most DVCS tools provide is a flexibility of workflow. Many people adopt a centralized workflow using services like GitHub or Bitbucket to host a remote copy of their repository. In this setup there is still fundamentally just two git repositories. One on your machine and one on the services remote servers. I strongly recommend reading the free git-scm book before getting started to familiarize yourself with what git is, how it works, and how to use it.

Solution 2:

Git is a distributed version control system (DVCS). There is no need for a git server though one can be set up if you insist on it. Sometimes a centralized server is used (think Github) and a local server can be set up, but this is usually not the way most git users use the system. Most people do in fact use git as a distributed system with no server and no hub.

You may want to read about the philosophy behind git:

Pro Git Book

Git Documentation

Strictly speaking Hg Init is talking about Mercurial which is another DVCS system but it does provide one of the most succinct and best explained descriptions of what a DVCS is, and it is still mostly relevant to git

Solution 3:

@Bush - sometimes people like to distribute knowledge a little too much vs just answering the question

Your reasons for setting up a GIT server can be whatever they are . services like Github & repositoryhosting.com basically provide GIT servers for you to use as remotes

so i am assuming you also want a remote setup on your own where you can push code to ?

here is a few tutorials you should use :

http://git-scm.com/book/en/Git-on-the-Server-Public-Access

you can also use something called Gitolite - another tutorial is at http://realcnbs.com/