How to setup own GIT Server? Whats bare/non-bare repos?

Solution 1:

A "normal" repository is a directory containing the actual repository, and a working copy. The actual repository is located in a hidden subdirectory with the name .git. The working copy are those files and directories you work with.

A "bare" repository is just the contents of the .git directory, without a working copy.

You can not work on a bare repository. You first have to clone the bare repository to a normal repository, then work on the clone.

In your first attempt you created a "normal" repository. Then you cloned that. Then you tried to push back to the normal repository. Then you got a warning. You should not push to a normal repository. Git warns you when you try to do that. You should only push to a bare repository.

In your second attempt you created a "bare" repository. Then you created a "normal" repository. Then you pushed from the normal to the bare repository. That is (one of) the expected workflow(s). That is why you got no errors or warnings.

When you want to work on your project from the windows machine and from the ubuntu machine then you have two options:

  1. Create a bare repository (doesn't matter where). Then clone from that repository, one on the windows machine and one on the ubuntu machine. Now push from the clones to the bare repository, and pull from the bare repository to the clones. Do not push to the normal repositories.

  2. Create two normal repositories, one on the windows machine and one on the ubuntu machine. Now, when working on ubuntu, you can pull from the windows machine and vice versa. Do not push to each other.

Bottom line: only ever push to bare repositories. In all other cases, when you think you want to push from A to B, instead, go to B then pull from A.

It seems that you are very new to git. Please read one or both of the following very fine books: Git Book, Pro Git.

Solution 2:

Why don't you just use MSysGit, here is some nettuts:

How to install and setup a Git Repository Server using Gitolite on Linux Ubuntu 11.04 or 10.04 with Windows clients using MSysGit

or

How to install and setup a Git Repository Server using Gitolite on Linux Ubuntu 10.04 & 11.04 [Development Environment]