2

This post says

in a bar Git repository, there is no working copy and the folder (let's call it repo.git) contains the actual repository data

however after experiment,I found it's not true.

There's still .git directory in a bare repository.

So what's the difference at all?

2 Answers 2

3

Reiterating...

A standard git repository is a working copy with the git data stored in the .git directory.

A bare git repository does not have a working copy, and is in essence only the .git directory (but is not named .git, it's named whatever you called it).

That post you found is exactly correct.

1

Just tested this. No directory named .git is present in a bare repository.

~/test$ git --bare init
Initialized empty Git repository in /home/user/test/
~/test$ ls -a
.  ..  HEAD  branches  config  description  hooks  info  objects  refs

If you have one, then your bare repository isn't actually a bare repository. What steps are you taking to create or clone your repository?

3
  • 1
    This isn't quite correct. See my answer.
    – bahamat
    Aug 15, 2011 at 4:20
  • @bahamat I am aware that a bare repo is equivalent to the contents of the .git directory of a normal repo. I meant, in the quite literal sense, that a bare repo doesn't contain a directory named .git. He's got one, which is why I asked how he's creating his clone. Aug 15, 2011 at 5:22
  • @bahamat After a re-read, I can see why you felt the need to clarify. I've edited to make the aspects of the answer less opaque. Thanks, and +1 to your answer. Aug 15, 2011 at 6:48

Not the answer you're looking for? Browse other questions tagged .